RIP
Tutorial
Tags
Topics
Examples
eBooks
Tutorial by Examples
creating a UDT with a single int column that is also a primary key
CREATE TYPE dbo.Ids as TABLE ( Id int PRIMARY KEY )
Creating a UDT with multiple columns
CREATE TYPE MyComplexType as TABLE ( Id int, Name varchar(10) )
Creating a UDT with a unique constraint:
CREATE TYPE MyUniqueNamesType as TABLE ( FirstName varchar(10), LastName varchar(10), UNIQUE (FirstName,LastName) ) Note: constraints in user defined table types can not be named.
Creating a UDT with a primary key and a column with a default value:
CREATE TYPE MyUniqueNamesType as TABLE ( FirstName varchar(10), LastName varchar(10), CreateDate datetime default GETDATE() PRIMARY KEY (FirstName,LastName) )
Page 1 of 1
1
Cookie
This website stores cookies on your computer.
We use cookies to enhance your experience on our website and deliver personalized content.
For more details on our cookie usage, please review our
Cookie Policy
and
Privacy Policy
Accept all Cookies
Leave this website