sqlserver得到此数据库所有的表名列名以及列名的类型,字节数等

得到此数据库所有的表名列名以及列名的类型,字节数等

select
a.Name as 表名,
b.Name as 列名,
c.Name as 类型,
b.max_length as 字节数,
b.Precision as 整数位,
b.Scale as 小数位
from Sys.tables a
inner join Sys.columns b on a.object_id=b.object_id
inner join sys.Types
c on c.User_Type_ID=b.User_Type_ID

在哪个表里查询哪个字段的类型等详细信息可以这样

select
a.Name as 表名,
b.Name as 列名,
c.Name as 类型,
b.max_length as 字节数,
b.Precision as 整数位,
b.Scale as 小数位
from Sys.tables a
inner join Sys.columns b on a.object_id=b.object_id
inner join sys.Types
c on c.User_Type_ID=b.User_Type_ID where a.name='表名' and b.Name='列名'



posted @ 2012-01-04 09:14  一个土豆一棵青菜  阅读(1257)  评论(0编辑  收藏  举报