2005与2000有点不一样,2000中可以使用sysproperties来获取描述值,而2005中已取消了.但是可以使用sys.extended_properties来获取.用法和以前一样。

select TBL.name as TableName,TBL.id as TableID,COL.name as ColName,TYPE.name as Type,
 COL.length as Length,COM.text as defaultValue,IDX.indid as isPrimarykey,
PT.value as description,
COL.status as status,COL.isnullable as isNull,
 COL.xprec as prec,COL.xscale as scale
 from sysobjects TBL
 left join syscolumns COL on TBL.id=COL.id
 left join systypes TYPE on COL.xusertype=TYPE.xusertype
 left join syscomments COM on COL.cdefault=COM.id
 left join sysindexkeys IDX on COL.id=IDX.id and COL.colid=IDX.colid and IDX.indid=1
left join sys.extended_properties PT on COL.id=PT.major_id and COL.colid=PT.minor_id

posted on 2008-12-29 10:43  ringnet  阅读(554)  评论(0编辑  收藏  举报