SQL查询表结构的语句
来源:互联网 发布:office办公软件学习 编辑:程序博客网 时间:2024/05/01 12:55
SQL查询表结构的语句
select
( case when a.colorder = 1 then d.name else '' end ) 表名,
a.colorder 字段序号,
a.name 字段名,
( case when COLUMNPROPERTY (a.id,a.name,'isidentity') = 1 then '√' else '' end ) 标识,
( 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 ) 主键,
b.name 类型,
a.length 字节数, COLUMNPROPERTY ( a.id,a.name ,'PRECISION' ) as 长度,
isnull ( COLUMNPROPERTY ( a.id,a.name ,'Scale'),0) as 小数位数,
(case when a.isnullable = 1 then '√' else '' end ) 允许空,
isnull ( e.text,'') 默认值,
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 sysproperties g
on a.id = g.id and a.colid = g.smallid
where d.name='tb_latency_cust'----写上自己要查询的表名
order by a.id ,a.colorder
- SQL查询表结构的语句
- 查询表结构的SQL语句
- Sql 语句查询表结构
- SQL SERVER 查询表结构的SQL语句
- 单表查询树形结构的SQL语句
- SQL语句查询出数据库中所有表的结构
- SQL查询语句的基本结构
- SQL 查询语句语法结构大全+【SQL 复制表】
- 如何用SQL查询语句获取Oracle表 树形结构的记录(PL/SQL )
- 查询MSSQL数据库中表结构的详细信息的SQL语句
- sql 树形结构查询语句 (sql 2005+)
- [SQL] 查询表的主键sql语句
- 用于SQL2005的表结构查询语句
- Oracle查询表结构的常用语句
- 商城中商品筛选的SQL查询组合语句的实现,表结构、传值都完成!
- 使用SQL语句查询数据库信息及表结构
- oracle父子结构表递归查询sql语句
- SQL语句查询表结构信息(字段信息)
- “Java之父”James Gosling
- 半年没有关心这个博客了
- 转移成本
- 48 Ways to Wisdom - Way 4, Introduce Yourself to Yourself
- 关于C++中指针的概念
- SQL查询表结构的语句
- PHP中使用FCKeditor2.3.2配置
- oracle数据库文件中的导入/导出(imp/exp命令)
- 讲演的艺术
- Microsoft .Net Remoting系列专题之一
- 笔书人生
- 在java判断字符串有多少中文字
- ASP.Net+XML打造留言薄
- VS2005打包时加入卸载功能