查看sqlserver2008表和字段注释的方法
来源:互联网 发布:cnc编程教学下载 编辑:程序博客网 时间:2024/06/14 23:47
方法一:
SELECT
A.name AS table_name,
B.name AS column_name,
C.value AS column_description
FROM sys.tables A
INNER JOIN sys.columns B ON B.object_id = A.object_id
LEFT JOIN sys.extended_properties C ON C.major_id = B.object_id AND C.minor_id = B.column_id
WHERE A.name = '表名'
方法二:
SELECT
表名=case when a.colorder=1 then d.name else '' end,
表说明=case when a.colorder=1 then isnull(f.value,'') else '' end,
字段序号=a.colorder,
字段名=a.name,
标识=case when COLUMNPROPERTY( a.id,a.name,'IsIdentity')=1 then '√'else '' end,
主键=case when exists(SELECT 1 FROM sysobjects where xtype='PK' and name in (
SELECT name FROM sysindexes WHERE indid in(
SELECT indid FROM sysindexkeys WHERE id = a.id AND colid=a.colid
))) then '√' else '' end,
类型=b.name,
占用字节数=a.length,
长度=COLUMNPROPERTY(a.id,a.name,'PRECISION'),
小数位数=isnull(COLUMNPROPERTY(a.id,a.name,'Scale'),0),
允许空=case when a.isnullable=1 then '√'else '' end,
默认值=isnull(e.text,''),
字段说明=isnull(g.[value],'')
FROM syscolumns a
left join systypes b on a.xusertype=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
left join sys.extended_properties f on d.id=f.major_id and f.minor_id=0
--where d.name='orders' --如果只查询指定表,加上此条件
order by a.id,a.colorder
- 查看sqlserver2008表和字段注释的方法
- 查看文章 mysql:表注释和字段注释
- 查看文章 mysql表注释和字段注释
- 查看文章 mysql:表注释和字段注释
- 查看文章 mysql:表注释和字段注释
- Oracle中查看所有表和字段以及表注释.字段注释
- Oracle中查看所有表和字段以及表注释.字段注释
- Oracle中查看所有表和字段以及表注释.字段注释
- Oracle中查看所有表和字段以及表注释.字段注释
- Oracle中查看所有表和字段以及表注释.字段注释
- SQL查看表注释、字段注释
- 查看表创建的sql脚本以及字段注释
- mysql添加表注释、字段注释、查看与修改注释
- mysql查询表和字段的注释
- oracle查看该用户的所有表名字、表注释、字段名、字段注释、是否为空、字段类型
- 获取mysql的表注释和字段注释
- oracle :查询表的字段和字段注释。
- oracle 查看表 字段明细 注释
- lambda 引入符
- 工作计划
- mvc下粗略使用Ninject
- React Native 小实例 采用View布局如下视图
- Unity移动端下载Zip文件并解压
- 查看sqlserver2008表和字段注释的方法
- ViewExcel
- java.lang.System 的in是final的,为什么要有public static void setIn(InputStream in)方法?
- 分布式事务:不过是在一致性、吞吐量和复杂度之间,做一个选择
- eclipse新建maven webapp后无法添加src/main/java和src/main/test
- Android 之LayoutInflater.from
- 回编译apk时,出现找不到系统资源问题
- @RequestBody和@ResponseBody的简单使用接收JSON(接收json数据)
- Linux常用命令