首页 新闻 会员 周边

想问一下sql2005中用户定义类型和用户定义数据类型的区别

0
悬赏园豆:15 [已关闭问题] 关闭于 2013-09-17 11:19

如题目

用户定义类型为什麽不能通过右键创建

还有下面语句为什麽会报错,是不是sql2008才能创建表类型?

问题补充:

语法都是一样吗?都是下面这个

 1 CREATE TYPE [ schema_name. ] type_name
 2 { 
 3     FROM base_type 
 4     [ ( precision [ , scale ] ) ]
 5     [ NULL | NOT NULL ] 
 6   | EXTERNAL NAME assembly_name [ .class_name ] 
 7   | AS TABLE ( { <column_definition> | <computed_column_definition> }
 8         [ <table_constraint> ] [ ,...n ] )  
 9 } [ ; ]
10 
11 <column_definition> ::= 
12 column_name <data_type>
13     [ COLLATE collation_name ] 
14     [ NULL | NOT NULL ]
15     [ 
16         DEFAULT constant_expression ] 
17       | [ IDENTITY [ ( seed ,increment ) ] 
18     ]
19     [ ROWGUIDCOL ] [ <column_constraint> [ ...n ] ] 
20 
21 <data type> ::= 
22 [ type_schema_name . ] type_name 
23     [ ( precision [ , scale ] | max | 
24                 [ { CONTENT | DOCUMENT } ] xml_schema_collection ) ] 
25 
26 <column_constraint> ::= 
27 {     { PRIMARY KEY | UNIQUE } 
28         [ CLUSTERED | NONCLUSTERED ] 
29         [ 
30             WITH ( <index_option> [ ,...n ] ) 
31         ]
32   | CHECK ( logical_expression ) 
33 } 
34 
35 <computed_column_definition> ::= 
36 column_name AS computed_column_expression 
37 [ PERSISTED [ NOT NULL ] ]
38 [ 
39     { PRIMARY KEY | UNIQUE }
40         [ CLUSTERED | NONCLUSTERED ]
41         [ 
42             WITH ( <index_option> [ ,...n ] )
43         ]
44     | CHECK ( logical_expression ) 
45 ] 
46 
47 <table_constraint> ::=
48 { 
49     { PRIMARY KEY | UNIQUE } 
50         [ CLUSTERED | NONCLUSTERED ] 
51                               ( column [ ASC | DESC ] [ ,...n ] ) 
52         [ 
53            WITH ( <index_option> [ ,...n ] ) 
54         ]
55     | CHECK ( logical_expression ) 
56 } 
57 
58 <index_option> ::=
59 { 
60     IGNORE_DUP_KEY = { ON | OFF } 
61 }

http://msdn.microsoft.com/zh-cn/library/ms175007.aspx

看了MSDN,创建用户定义表类型只有sql2008才有

桦仔的主页 桦仔 | 初学一级 | 园豆:62
提问于:2013-05-09 11:54
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册