Which Transact-SQL statement should you use?

You administer a Microsoft SQL Server 2008 database named AdventureWork that contains a table named Production.Product.
The table has the following definition:
CREATE TABLE [Production].[Product](
[ProductID] [int] IDENTITY(1,1) NOT NULL,
[ProductName] [nvarchar](50) NOT NULL,
[ListPrice] [money] NOT NULL,
[ProductionDate] [datetime] NULL,
[UserCreated] [nvarchar](128) NOT NULL,
[DateCreated] [datetime] NOT NULL DEFAULT GETDATE(),
CONSTRAINT [PK_Product_ProductID] PRIMARY KEY CLUSTERED ([ProductID] ASC) ON [PRIMARY]) ON [PRIMARY]
GO
You want to add a new product named Widget and a list price of 10.50 U.S. dollars to the product table. You need to add a record for the product information.
You also need to set the DateCreated field to the current date and the UserCreated field to your Windows login identification name.
Which Transact-SQL statement should you use?
A. INSERT INTO [Production].[Product](ProductID, ProductName, ListPrice, UserCreated, DateCreated)
values(1, ‘Widget’, 10.50, system_user, GETDATE())
B. INSERT INTO [Production].[Product](ProductName, ListPrice, UserCreated)
values(‘Widget’,10.50, system_user)
C. INSERT INTO [Production].[Product](ProductName, ListPrice, UserCreated, ProductionDate)
values(‘Widget’, 10.50, user_id(), GETDATE())
D. INSERT INTO [Production].[Product](ProductName, ListPrice, DateCreated)
values(‘Widget’,10.50, GETDATE())
E. INSERT INTO [Production].[Product](ProductID, ProductName, ListPrice, UserCreated, DateCreated)
select 1, ‘Widget’, 10.50, system_user, GETDATE()
F. INSERT INTO [Production].[Product](ProductName, ListPrice, UserCreated)
select ‘Widget’,10.50, system_user
G. INSERT INTO [Production].[Product](ProductName, ListPrice, UserCreated, ProductionDate)
select’Widget’, 10.50, user_id(), GETDATE()
H. INSERT INTO [Production].[Product](ProductName, ListPrice, DateCreated)
select ‘Widget’,10.50, GETDATE()

microsoft-exams

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.