一句SQL语句搞定。
SELECT table_name AS 数据表名,
column_name AS 字段名,
ISNULL(column_default,'') AS 默认值,
is_nullable AS 是否允许为NULL,
data_type AS 数据类型,
ISNULL(ISNULL(ISNULL(character_maximum_length,numeric_precision),datetime_precision),1) AS 类型长度
FROM information_schema.columns
WHERE NOT table_name IN('sysdiagrams','dtproperties')
order by table_name,column_name
转载请注明出处
《SQL SERVER 中获取数据库的所有表、字段、数据类型等信息》https://www.ywlib.com/archives/14.html (from 一闻自习室)
本文固定链接
https://www.ywlib.com/archives/14.html
标签
sql server, mssql