1.首先需要填写表的每一列的说明
2.创建试图
GO
/****** Object: View [dbo].[sura_view_dbdictionary] Script Date: 05/31/2013 17:19:19 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[sura_view_dbdictionary]
AS
/**
*曹飞龙新建数据库字典
* test_DB为数据库的名字
**/
SELECT c.name AS tablename, a.name AS colname, d.DATA_TYPE AS type, b.value
FROM sys.syscolumns AS a LEFT OUTER JOIN
sys.extended_properties AS b ON a.colid = b.minor_id AND a.id = b.major_id LEFT OUTER JOIN
sys.sysobjects AS c ON c.id = a.id LEFT OUTER JOIN
INFORMATION_SCHEMA.COLUMNS AS d ON d.TABLE_NAME = c.name AND d.COLUMN_NAME = a.name
WHERE (d.TABLE_CATALOG = 'test_DB')
GO
3.查询试图
select * from sura_view_dbdictionary where tablename='sura_storeroom'