select a.[name] tName,b.[name] columnName,b.xtype columnType,b.[type],b.Length,b.prec,b.IsNullable,b.colorder,(case when pk.COLUMN_NAME is null then 0 else 1 end) PK
from sysobjects a
left join syscolumns b on a.id=b.id
left join [INFORMATION_SCHEMA].KEY_COLUMN_USAGE pk
on pk.Table_Name=a.[name] and pk.COLUMN_NAME=b.[name]
where a.xtype='u' and b.[name]='salary'
转载于:https://www.cnblogs.com/sndyzhang/archive/2011/06/27/2091472.html