时间:2021-07-01 10:21:17 帮助过:19人阅读
/*============================================================================== * *Filename:GetTable.sql *Description:sql2000和2005以上数据库---获取数据库中所有的表(不包括系统表 *Version:1.0 *Created:2013.08.15 *Author:liangjw *E-mail:lia
/*==============================================================================---------------------------------------------------------------------------- --sql 2005以上数据库 --- 获取数据库中所有的表(不包括系统表) ---------------------------------------------------------------------------- SELECT 表名 = CASE WHEN a.colorder = 1 THEN d.name ELSE '' END , 表说明 = CASE WHEN a.colorder = 1 THEN ISNULL(f.value, '') ELSE '' END FROM syscolumns a INNER JOIN sysobjects d ON a.id = d.id AND d.xtype = 'U' AND d.name <> 'sys.extended_properties' AND d.name <> 'dtproperties' LEFT JOIN sys.extended_properties f ON a.id = f.major_id AND f.minor_id = 0 WHERE ( CASE WHEN a.colorder = 1 THEN d.name ELSE '' END ) <> '' ORDER BY 表名 ---------------------------------------------------------------------------- --sql 2000数据库 --- 获取数据库中所有的表(不包括系统表) ---------------------------------------------------------------------------- SELECT 表名 = CASE WHEN a.colorder = 1 THEN d.name ELSE '' END , 表说明 = CASE WHEN a.colorder = 1 THEN ISNULL(f.value, '') ELSE '' END FROM syscolumns a INNER JOIN sysobjects d ON a.id = d.id AND d.xtype = 'U' AND d.name <> 'sys.extended_properties' AND d.name <> 'dtproperties' LEFT JOIN sysproperties f ON a.id = f.id AND f.smallid = 0 WHERE ( CASE WHEN a.colorder = 1 THEN d.name ELSE '' END ) <> '' ORDER BY 表名