SELECT
a.name,
b.COLUMN_NAME,
‘1‘ AS aflag
FROM sys.tables a
LEFT JOIN information_schema.columns b ON b.table_name=a.name AND b.COLUMN_NAME IN(‘scantime‘,‘时间‘,‘stime‘,‘time‘)
WHERE name LIKE ‘PAR_%‘ AND a.name NOT LIKE ‘%_Removed‘ AND b.COLUMN_NAME IS NOT NULL
原文:http://www.cnblogs.com/twzy/p/5209102.html