查询数据库中某字段在所有表中信息
--查询数据库DPII中含['Org_ID','Client_ID','Sender_ID','Receiver_ID','Vendor_Id']字段的表 
use DPII
GO
SELECT o.[name] as tname, c.[name] as fname, c.length, t.[name] as type
from dbo.sysobjects o inner join dbo.syscolumns c
on o.id=c.id and c.[name] in ('Org_ID','Client_ID','Sender_ID','Receiver_ID','Vendor_Id')
left join dbo.systypes t on c.xtype=t.xusertype
where o.xtype='U' and o.status>0

浙公网安备 33010602011771号