SQLSERVER查询字段类型

select a.name 表名,
 b.name 字段名,
 case c.name when 'numeric' then 'numeric(' + convert(varchar,b.length) + ',' + convert(varchar,b.xscale) + ')'
 when 'char' then 'char(' + convert(varchar,b.length) + ')'
 when 'varchar' then 'varchar(' + convert(varchar,b.length) + ')'
 else c.name END AS 字段类型
from sysobjects a,syscolumns b,systypes c where a.id=b.id
and a.name='表名' and a.xtype='U'
and b.xtype=c.xtype




posted @ 2023-04-03 15:44  水向东流时间怎么偷  阅读(237)  评论(0编辑  收藏  举报
Live2D