False. Let’s look at the definition of a table variable:
DECLARE @myTableVar TABLE
(companyID INT NOT NULL,
companySize INT NOT NULL)
The constraints allowed on table variables are : PRIMARY KEY,UNIQUE KEY and NULL.
A PRIMARY KEY constraint can only be defined if certain criteria are met: No duplicate values
A UNIQUE KEY Creates a unique index on a table or view. A unique index is one in which no two rows are permitted to have the same index key value
To create a PRIMARY KEY constraint :
DECLARE @myTableVar TABLE
(companyID INT PRIMARY KEY,
companyName INT NOT NULL
)
Source:Jack Vamvas (http://www.sqlserver-dba.com)
Author: Jack Vamvas (http://www.sqlserver-dba.com)
This is only a preview. Your comment has not yet been posted.
As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.
Having trouble reading this image? View an alternate.
Posted by: |