本文共 811 字,大约阅读时间需要 2 分钟。
string sql = string .Format( @" SELECT syscolumns.colid, Sysobjects.name AS [TableName], syscolumns.name AS [ColumnName], systypes.name AS [DataType], syscolumns.length AS [DataLength], sys.extended_properties.[value] AS [Description], syscomments.text AS [DefaultValue], syscolumns.isnullable AS [NullAble] FROM syscolumns INNER 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 NAME = '{0}') AND (systypes.name <> 'sysname') ORDER BY syscolumns.colid " , tbName); 转载地址:http://aamyo.baihongyu.com/