【转】查询表结构
2016-04-30 10:26
288 查看
关于查询表结构
查询某张表的字段信息的话还可用如下方法:
-- 查询非系统数据库 Select name FROM Master.. SysDatabases where dbid>4 -- 选择water数据库下的所有表 use [water] SELECT name FROM sysobjects WHERE xtype = 'U' Or xtype = 'S' -- 选择water数据库下的所有用户表 use [water] SELECT name FROM sysobjects WHERE xtype = 'U' AND OBJECTPROPERTY (id, 'IsMSShipped') = 0 -- 查询water数据库下的admin表的字段名,长度,类型,字段说明 use [water] SELECT a.[name] as '字段名',a.length '长度',c.[name] '类型',e.value as '字段说明' FROM syscolumns a left join systypes b on a.xusertype=b.xusertype left join systypes c on a.xtype = c.xusertype inner join sysobjects d on a.id=d.id and d.xtype='U' left join sys.extended_properties e on a.id = e.major_id and a.colid = e.minor_id and e.name='MS_Description' where d.name='admin'sys.extended_properties系统内置视图用于存储字段说明。
查询某张表的字段信息的话还可用如下方法:
select * from information_schema.columns where table_name ='colocal'
相关文章推荐
- 士兵杀敌(二)
- HTML列表
- ComboBox用AddString添加字符显示乱码
- 安卓定位的四种介绍方式
- 如何用Maven创建web项目(具体步骤)
- ARM汇编 – (2) ARM程序状态寄存器
- 《初始化块:普通初始化块、静态初始化块(类初始化块)》
- Struts2 S2 – 032远程代码执行漏洞分析报告
- ListView 中嵌入GridView去滚动效果
- 个人总结 Yii 部分关键代码
- HTML 表格
- HttpURLConnection请求
- 解决windows 10关机自动重启的问题
- HDU 1203 I NEED A OFFER!
- 如何使用gson解析泛型形参并返回相对应的类
- ubuntu 14.04 java开发环境搭建 jdk 以及 inteliJ IDEA安装
- MF图C中作流程
- 十、森林与并查集---(2)并查集的创建
- Codeforces 667C Reberland Linguistics 记忆化搜索
- extjs2下拉树选项框comboxWithTree(支持异步加载子节点)