SELECT (CASE WHEN a.colorder=1 THEN d.name ELSE '' END) N'表名', a.colorder N'字段序号', a.name N'字段名', (CASE WHEN COLUMNPROPERTY( a.id,a.name,'IsIdentity')=1 THEN ''ELSE '' END) N'标识', (CASE WHEN (SELECT COUNT(*) FROM sysobjects WHER
select
(case when a.colorder=1 then d.name else '' end) n'表名',
a.colorder n'字段序号',
a.name n'字段名',
(case when columnproperty( a.id,a.name,'isidentity')=1 then '√'else '' end) n'标识',
(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 '' end) n'主键',
b.name n'类型',
a.length n'占用字节数',
columnproperty(a.id,a.name,'precision') as n'长度',
isnull(columnproperty(a.id,a.name,'scale'),0) as n'小数位数',
(case when a.isnullable=1 then '√'else '' end) n'允许空',
isnull(e.text,'') n'默认值',
isnull(g.[value],'') as n'字段说明'
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 = 'sw_project' --要查询的表
order by
object_name(a.id), a.colorder
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号