查询某一个字段在本数据库中的那几张表中出现过
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'
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'