以下的文章主要是将SQL Server所有表的相关列信息显示出来,如果你对SQL Server所有表的相关列信息有兴趣的话,你就可以对以下的文章点击观看了,以下就是文章的主要内容的详细描述,望大家在浏览之后会对其有更深的了解。
以下为引用的内容:
- SELECT SysObjects.Name as tb_name, SysColumns.Name as col_name,
- SysTypes.Name as col_type, SysColumns.Length as col_len, isnull
- (SysProperties.Value,SysColumns.Name) as col_memo,
- case when SysColumns.name in
- (select 主键=a.name
- FROM syscolumns a
- inner join sysobjects b on a.id=b.id and
- b.xtype='U' and b.name<>'dtproperties'
- where 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
- )))
- and b.name=SysObjects.Name
- )
- then 1 else 0 end as is_key
- FROM SysObjects,SysTypes,SysColumns
- LEFT JOIN SysProperties ON (Syscolumns.Id = Sysproperties.Id AND
- Syscolumns.Colid = Sysproperties.Smallid)
- WHERE (Sysobjects.Xtype ='u' OR Sysobjects.Xtype ='v')
- AND Sysobjects.Id = Syscolumns.Id AND SysTypes.XType = Syscolumns.XType
- AND SysTypes.Name <> 'sysname' AND Sysobjects.
- Name Like '%' ORDER By SysObjects.Name, SysColumns.colid
上述的相关内容就是对将SQL Server所有表的列信息显示出来:的描述,希望会给你带来一些帮助在此方面。
【编辑推荐】