查看SQLServer数据表的详细信息。
2008-04-27 06:33
459 查看
SELECT
表名=casewhena.colorder=1thend.nameelse''end,
表说明=casewhena.colorder=1thenisnull(f.value,'')else''end,
字段序号=a.colorder,
字段名=a.name,
标识=casewhenCOLUMNPROPERTY(a.id,a.name,'IsIdentity')=1then'√'else''end,
主键=casewhenexists(SELECT1FROMsysobjectswherextype='PK'andnamein(
SELECTnameFROMsysindexesWHEREindidin(
SELECTindidFROMsysindexkeysWHEREid=a.idANDcolid=a.colid
)))then'√'else''end,
类型=b.name,
占用字节数=a.length,
长度=COLUMNPROPERTY(a.id,a.name,'PRECISION'),
小数位数=isnull(COLUMNPROPERTY(a.id,a.name,'Scale'),0),
允许空=casewhena.isnullable=1then'√'else''end,
默认值=isnull(e.text,''),
字段说明=isnull(g.[value],'')
FROMsyscolumnsa
leftjoinsystypesbona.xtype=b.xusertype
innerjoinsysobjectsdona.id=d.id andd.xtype='U'and d.name<>'dtproperties'
leftjoinsyscommentseona.cdefault=e.id
leftjoinsyspropertiesgona.id=g.idanda.colid=g.smallid
leftjoinsyspropertiesfond.id=f.idandf.smallid=0
--whered.name='要查询的表' --如果只查询指定表,加上此条件
orderbya.id,a.colorder
表名=casewhena.colorder=1thend.nameelse''end,
表说明=casewhena.colorder=1thenisnull(f.value,'')else''end,
字段序号=a.colorder,
字段名=a.name,
标识=casewhenCOLUMNPROPERTY(a.id,a.name,'IsIdentity')=1then'√'else''end,
主键=casewhenexists(SELECT1FROMsysobjectswherextype='PK'andnamein(
SELECTnameFROMsysindexesWHEREindidin(
SELECTindidFROMsysindexkeysWHEREid=a.idANDcolid=a.colid
)))then'√'else''end,
类型=b.name,
占用字节数=a.length,
长度=COLUMNPROPERTY(a.id,a.name,'PRECISION'),
小数位数=isnull(COLUMNPROPERTY(a.id,a.name,'Scale'),0),
允许空=casewhena.isnullable=1then'√'else''end,
默认值=isnull(e.text,''),
字段说明=isnull(g.[value],'')
FROMsyscolumnsa
leftjoinsystypesbona.xtype=b.xusertype
innerjoinsysobjectsdona.id=d.id andd.xtype='U'and d.name<>'dtproperties'
leftjoinsyscommentseona.cdefault=e.id
leftjoinsyspropertiesgona.id=g.idanda.colid=g.smallid
leftjoinsyspropertiesfond.id=f.idandf.smallid=0
--whered.name='要查询的表' --如果只查询指定表,加上此条件
orderbya.id,a.colorder
相关文章推荐
- SQLserver 查看表详细信息--删除重复数据
- 查看SQLServer数据表的详细信息
- 用Entity Framework往数据库插数据时,出现异常,怎么查看异常的详细信息呢?
- [Elixir005] 查看指定数据的详细信息 i helper
- 使用select @@version查看SQLserver的详细版本信息
- 查看DataList控件中数据的详细信息
- SQLServer查看表,提示“请参阅‘对象资源管理器详细信息’了解此文件家中的对象”
- 查看DataList控件中数据的详细信息1
- Oracle查看表空间详细信息
- SQLSERVER是怎麽通过索引和统计信息来找到目标数据的(第一篇)
- 查看当前文件夹下含有wyy字串的文件及详细信息
- Ubuntu下查看CPU、内存和硬盘详细信息
- Qt 之 解析wav文件的头信息(详细分析、对比不同wav文件的数据)
- sqlserver 利用sql获取表详细信息
- ORACLE查看数据文件-控制文件-日志文件-表空间信息
- 怎么查看win7系统详细的性能配置和系统信息?
- 怎么查看Unix系统下某个进程的详细信息及端口对应的进程信息
- 在系统启动时至少有一个服务或驱动程序产生错误。详细信息,请使用事件查看器查看事件日志
- hive表信息,以及查看数据的些
- 查询视图和单条数据的详细信息不用同一个视图,