当前位置: 首页 > 图文教程 > 数据库 > MSSQL > 收藏几段SQL Server语句和存储过程

MSSQL
SQL Server 2005查看文件及文件组的语句
用最简单的步骤备份SQL数据库的文件到本地
在SQL Server数据库中拆分字符串函数
SQL Server数据库维度表和事实表概述
Microsoft SQL Server数据库日志截断
SQL Server 2000 SP4与数据链接池问题
SQL Server游标使用实例
SQL Server 2008:传递表值参数
微软SQL Server 2008令商业智能平民化
将SQL2000数据库升级到SQL2005
在SQL Server2005中进行错误捕捉
动态SQL语句的编程
SQL Server 2008升级报表服务器数据库
在SAN上创建SQL Server群集
SQL查询中的转义序列不对的解决办法
SQL2005一个不起眼但很实用的函数
管理SQL Server数据库和应用元数据
选择SQL Server恢复模型确保正确备份
查看SQL执行计划常用方法
SQL2008增强的集成开发环境

MSSQL 中的 收藏几段SQL Server语句和存储过程


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-10-30   浏览: 113 ::
收藏到网摘: n/a

-- ======================================================

--列出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)