数据字典(SQL语句)
来源:互联网 发布:mac docker 启动 编辑:程序博客网 时间:2024/05/22 05:31
declare @tmp table
(
id int identity(1,1),
TableName varchar(100),
Column_name varchar(100),
Type varchar(50),
Lenght int,
Scale int,
Nullable varchar(1),
Defaults varchar(4000),
PrimaryKey varchar(1)
)
select iid = identity(int,1,1), * into #a from SysObjects where xtype = 'U'
declare @i int
declare @max int
declare @table varchar(100)
set @i = 1
select @max = max(iid) from #a
while @i <= @max
begin
select @table = name from #a where iid = @i
if @@rowcount > 0
begin
insert @tmp (TableName, Column_name, Type, Lenght, Scale, Nullable, Defaults,PrimaryKey)
select @table, a.name, c.name, a.length, a.xscale, case a.isnullable when 0 then 'N' else 'Y' end, isnull(d.text,''), case when x.PrimaryKey is null then '' else x.PrimaryKey end
from SysColumns a with(nolock)
inner join (select * from SysObjects with(nolock) where xtype = 'U' and id = object_id(@table)) b on a.id = b.id
inner join SysTypes c with(nolock) on a.xtype = c.xusertype
left join syscomments d with(nolock) on a.cdefault = d.id
left join
(select f.id, colid, 'Y' as PrimaryKey from SysIndexKeys f with(nolock), SysIndexes e, SysObjects g
where f.id = e.id and f.indid = e.indid and f.id = g.parent_obj and e.name = g.name
and g.xtype = 'PK' and g. parent_obj = object_id(@table)) x on a.id = x.id and a.colid = x.colid
end
set @i = @i + 1
end
select * from @tmp
- 数据字典(SQL语句)
- SQL生成数据字典语句
- 通过sql语句得到数据字典(zz)
- 用Sql语句生成Sqlserver数据字典
- 收藏,通过sql语句得到数据字典
- 生成数据字典的sql语句
- 用Sql语句生成Sqlserver数据字典
- Oracle查询简单数据字典SQL语句
- 获取MSSQL数据字典的SQL语句
- 使用SQL语句生成数据字典
- 通过sql语句生成MySQl数据字典
- SQLServer2008/2005 生成数据字典SQL语句
- SQLServer2008/2005 生成数据字典SQL语句
- SQLServer2008/2005 生成数据字典SQL语句
- 将数据字典自动生成sql语句
- sqlserver导出 数据字典的SQL语句
- SQLServer2008/2005 生成数据字典SQL语句
- SQLServer2008/2005 生成数据字典SQL语句
- 怎么在Linux中添加新的系统调用
- 用C#实现动态生成Word文档,在Word文档中插入表格,并将读出的数据填入到表格中
- 有用的sql语句
- nginx rewrite 表达式规则
- 一年编程之总结
- 数据字典(SQL语句)
- linux不是”玩具“
- 抓取的一些疑问
- UltraEdit 关键字颜色显示的问题
- HTMLParser使用详解(3)
- zend架构的学习心得
- 我对上帝有意见!
- 表格行变色 live方式,用于ajax
- ERROR: ORA-01033: ORACLE initialization or shutdown in progress