|
提取Sql Server中指定表的字段信息(包括字段名 字段类型 长度 是否允许为空等)
SELECT SC.name 'FieldName', SC.Xtype 'DataType', st.name 'FieldType', SC.Length, isnullable
FROM <st1:Street><st1:address>SysCOlumns SC INNER JOIN SysTypes ST</st1:address></st1:Street> on SC.xtype = St.xtype
WHERE ID = (Select ID FROM SysObjects
WHERE xtype = 'u' AND name = 'epd_item_master')
ORDER BY ColOrder
将epd_item_master改为你自己的表名称
输出内容类似下面:
FieldName DataType FieldType Length isnullable
-------------------------------------------------------------------------------------------------------------------------------- -------- -------------------------------------------------------------------------------------------------------------------------------- ------ -----------
item_code 231 nvarchar 50 0
item_code 231 sysname 50 0
substitution 231 nvarchar 50 1
substitution 231 sysname 50 1
item_name 231 nvarchar 72 1
<FONT size=3><FONT face="Times New Roman">item_name |
|