日期:2014-05-17 浏览次数:20462 次
SELECT *
FROM ( SELECT a.name 'TabName' ,
b.name 'ColName'
FROM sys.tables a
INNER JOIN sys.columns b ON a.object_id = b.object_id
WHERE b.name IN ( '材料名称', '材料编码' )
) a
WHERE EXISTS ( SELECT 1
FROM ( SELECT a.name 'TabName' ,
b.name 'ColName'
FROM sys.tables a
INNER JOIN sys.columns b ON a.object_id = b.object_id
WHERE b.name IN ( '材料名称', '材料编码' )
) b
WHERE b.TabName = a.TabName
AND a.ColName <> b.ColName )
ORDER BY a.TabName