Which code segment should you use?

CORRECT TEXT
You have a database that contains the tables shown in the exhibit. (Click the Exhibit button.)

You deploy a new server that has SQL Server 2012 installed. You need to create a table named
Sales.OrderDetails on the new server. Sales.OrderDetails must meet the following requirements:
Write the results to a disk.
Contain a new column named LineItemTotal that stores the product of ListPrice and Quantity for
each row.
The code must NOT use any object delimiters.
The solution must ensure that LineItemTotal is stored as the last column in the table. Which code
segment should you use?
To answer, type the correct code in the answer area.

CORRECT TEXT
You have a database that contains the tables shown in the exhibit. (Click the Exhibit button.)

You deploy a new server that has SQL Server 2012 installed. You need to create a table named
Sales.OrderDetails on the new server. Sales.OrderDetails must meet the following requirements:
Write the results to a disk.
Contain a new column named LineItemTotal that stores the product of ListPrice and Quantity for
each row.
The code must NOT use any object delimiters.
The solution must ensure that LineItemTotal is stored as the last column in the table. Which code
segment should you use?
To answer, type the correct code in the answer area.

Answer: See the explanation

Explanation:
CREATE TABLE Sales.OrderDetails (
ListPrice money not null,
Quantity int not null,
LineItemTotal as (ListPrice * Quantity) PERSISTED)

http://msdn.microsoft.com/en-us/library/ms174979.aspx
http://technet.microsoft.com/en-us/library/ms188300.aspx



Leave a Reply 6

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


To

To

—create a table named Sales.OrderDetails
—the code must NOT use any object delimiters
CREATE TABLE Sales.OrderDetails (
ListPrice money not null,
Quantity int not null,
—Contain a new column named LineItemTotal that stores the product of ListPrice and Quantity
—LineItemTotal is stored as the last column in the table
LineItemTotal as (ListPrice * Quantity)
—Write the results to a disk
PERSISTED)

Jorik

Jorik

CREATE TABLE Sales.OrderDetails (
ListPrice money not null,
Quantity int not null,
LineItemTotal as (ListPrice * Quantity) PERSISTED)

Charl du Plessis

Charl du Plessis

CREATE TABLE Sales.OrderDetails (
ListPrice money not null,
Quantity int not null,
LineItemTotal as (ListPrice * Quantity) PERSISTED)

Ivo

Ivo

CREATE TABLE Sales.OrderDetails (
ListPrice money not null,
Quantity int not null,
LineItemTotal as (ListPrice * Quantity) PERSISTED)

Patty

Patty

Why NOT NULL, that is not a requirement.

CREATE TABLE Sales.OrderDetails
(
ListPrice MONEY,
Quantity INT,
LineItemTotal AS ListPrice * Quantity persisted
)

newbieDBA

newbieDBA

Look at first picture for Table OrderDetails, the Allow Nulls checkbox is not checked so you have to specify “NOT NULL” when creating the table otherwise you will get NULLS allowed to be input.