显示 Sql Server 中所有表中的信息

来源:http://www.mnuet.com 作者:产品分类 人气:159 发布时间:2020-02-29
摘要:展示有个别Sql Server有些数据库中全体表或视图的音信 sql server 二〇〇〇 与 2006区别 差异在于浅灰褐字部分以下语句为博得拥有表音信,替换灰白燕体字"U"为"V"为获取具有视图消息。

展示有个别Sql Server有些数据库中全体表或视图的音信 sql server 二〇〇〇 与 2006区别 差异在于 浅灰褐字部分以下语句为博得拥有表音信,替换灰白燕体字"U"为"V"为获取具有视图消息。

Sql Server 2000 版本

SELECT Sysobjects.name AS TABLE_NAME, syscolumns.Id, syscolumns.name AS COLUMN_NAME,systypes.name AS DATA_TYPE, syscolumns.length as CHARACTER_MAXIMUM_LENGTH, sysproperties.[value] AS COLUMN_DESCRIPTION, syscomments.text asCOLUMN_DEFAULT,syscolumns.isnullable as IS_NULLABLE FROM syscolumnsINNER JOIN systypes ON syscolumns.xtype = systypes.xtype LEFT JOIN sysobjects ON syscolumns.id = sysobjects.id LEFT OUTER JOIN sysproperties ON ( sysproperties.smallid = syscolumns.colid AND sysproperties.id = syscolumns.id) LEFT OUTER JOIN syscomments ON syscolumns.cdefault = syscomments.id WHERE syscolumns.id IN (SELECT id FROM SYSOBJECTS WHERE xtype = 'U') AND (systypes.name 'sysname') ORDER BY syscolumns.colid

Sql Server 2005版本

SELECT Sysobjects.name AS TABLE_NAME, syscolumns.Id, syscolumns.name AS COLUMN_NAME,systypes.name AS DATA_TYPE, syscolumns.length as CHARACTER_MAXIMUM_LENGTH, sys.extended_properties.[value] AS COLUMN_DESCRIPTION, syscomments.text asCOLUMN_DEFAULT,syscolumns.isnullable as IS_NULLABLE FROM syscolumnsINNER JOIN systypes ON syscolumns.xtype = systypes.xtype LEFT JOIN sysobjects ON syscolumns.id = sysobjects.id LEFT OUTER JOIN sys.extended_properties ON ( sys.extended_properties.minor_id = syscolumns.colid AND sys.extended_properties.major_id = syscolumns.id) LEFT OUTER JOIN syscomments ON syscolumns.cdefault = syscomments.id WHERE syscolumns.id IN (SELECT id FROM SYSOBJECTS WHERE xtype = 'U') AND (systypes.name 'sysname') ORDER BY syscolumns.colid

参考:

本文由广东十一选五一定牛发布于产品分类,转载请注明出处:显示 Sql Server 中所有表中的信息

关键词:

上一篇:SQL Server 中调整自增字段的当前初始值

下一篇:没有了

最火资讯