收藏几段SQL Server语句和存储过程,收藏几段SQL Server语句和存储过程
【 tulaoshi.com - SQLServer 】
-- ====================================================== 来源:http://www.tulaoshi.com/n/20160129/1496716.html
--列出SQL SERVER 所有表,字段名,主键,类型,长度,小数位数等信息
--在查询分析器里运行即可,可以生成一个表,导出到EXCEL中
-- ======================================================
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)
看过《收藏几段SQL Server语句和存储过程》的人还看了以下文章 更多>>