sql 怎么找出某一个列名长度等于8位数的
答案:2 悬赏:20 手机版
解决时间 2021-03-11 16:11
- 提问者网友:趣果有间
- 2021-03-10 16:18
sql 怎么找出某一个列名长度等于8位数的
最佳答案
- 五星知识达人网友:孤独的牧羊人
- 2021-03-10 17:32
SQL 二005及以上版本,执行如下,可获取字段及相关属性值 SELECt a.name 字段名 , COLUMNPROPERTY(a.id, a.name, 'IsIdentity') 标识 , ( CASE WHEN ( SELECT COUNT(*) FROM sysobjects WHERe ( name IN ( SELECt name FROM sysindexes WHERe ( id = a.id ) AND ( indid IN ( SELECt indid FROM sysindexkeys WHERe ( id = a.id ) AND ( colid IN ( SELECt colid FROM syscolumns WHERe ( id = a.id ) AND ( name = a.name ) ) ) ) ) ) ) AND ( xtype = 'PK' ) ) > 0 THEN '一' ELSE '0' END ) 主键 , b.name 类型 , COLUMNPROPERTY(a.id, a.name, 'PRECISION') AS 长度 , ISNULL(COLUMNPROPERTY(a.id, a.name, 'Scale'), 0) AS 小数位数 , ( CASE WHEN a.isnullable = 一 THEN '一' ELSE '0' END ) 允许空 , ISNULL(g.[value], '') AS 字段说明 FROM syscolumns a LEFT JOIN systypes b ON a.xtype = b.xusertype INNER JOIN sysobjects d ON a.id = d.id AND d.xtype = 'U' AND d.name > 'dtproperties' LEFT JOIN syscomments e ON a.cdefault = e.id LEFT JOIN sys.extended_properties g ON a.id = g.major_id AND a.colid = g.minor_id WHERe d.name = 'AA_AppFile' ORDER BY a.id , a.colorder 注:sql二000版本中,需要使用sysproperties来代替sys.extended_properties
全部回答
- 1楼网友:忘川信使
- 2021-03-10 18:25
select *from 表名 where len(表中字段名)<>25
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯