SQLServer 列出每个表的列和属性
时间:2014-05-16 06:11:58
收藏:0
阅读:339
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 |
USE DBProjectSY GO SELECT
OBJECT_SCHEMA_NAME(T.[object_id], DB_ID()) AS
[架构名] , T.[ name ] AS
[表名] , AC.[ name ] AS
[列名] , TY.[ name ] AS
[系统数据类型] , TY.is_user_defined AS
[是否用户自定义类型], --1 = 用户定义类型,0 = SQL Server 系统数据类型 AC.[max_length] [最大长度], AC.[ precision ] [精确度], --如果列包含的是数值,则为该列的精度;否则为0 AC.[scale] [数值范围], --如果列包含的是数值,则为列的小数位数;否则为0 AC.[is_nullable] [是否允许为空], AC.[is_ansi_padded][是否使用ANSI_PADDING] --1 = 如果列为字符、二进制或变量类型,则该列使用ANSI_PADDING ON 行为 FROM
sys.[tables] AS
T INNER
JOIN sys.[all_columns] AC ON
T.[object_id] = AC.[object_id] INNER
JOIN sys.[types] TY ON
AC.[system_type_id] = TY.[system_type_id] AND
AC.[user_type_id] = TY.[user_type_id] WHERE
T.[is_ms_shipped] = 0 ORDER BY T.[ name ] , AC.[column_id] |
评论(0)