Thursday, 14 June 2012

Using of User defined data types in sql server 2008 example

1) Create Type ename FROM nvarchar(20) not null
Create a type called called ename which has nvarchar(20) and not allowing nulls
 
2) Create table tab(id int,name ename)
Create and insert data into the new table 
insert into tab(id,name) 
 Select 1,'asdf' Union all
 Select 2,'badsf' Union all
 Select 3,'ertvfc'

3) Select * from tab

4) Drop table mytab; Drop Type MYTYPE 

Tags:User-Defined Table Types,Types,Types in sql server,sql server 2008 types

No comments:

Post a Comment

Parsing JSON w/ @ symbol in it

To read the json response like bellow @ concatenated with attribute                             '{ "@id": 1001, "@name&q...