SQL 查询两个数据库表的字段名的差异

SELECT * FROM
(
 SELECT B.NAME FROM SYSOBJECTS A
 LEFT JOIN SYSCOLUMNS B
 ON A.ID = B.ID
 WHERE A.NAME = '表名1'
) SS
WHERE NAME NOT IN
(
 SELECT B.NAME FROM SYSOBJECTS A
 LEFT JOIN SYSCOLUMNS B
 ON A.ID = B.ID
 WHERE A.NAME = '表名2'
)

你可能感兴趣的:(sql)