须要包括有几种状况
1、A表中有的字段B表无
2、B表有的A表无
3、两个表字段名不一致的post
------------------------------------------------------------------------blog
若是只对比字段名,能够这样it
1、A表中有的字段B表无
select name from syscolumns where id=object_id('A') and name not in(select name from syscolumns where id=object_id('B'))
2、B表有的A表无
select name from syscolumns where id=object_id('B') and name not in(select name from syscolumns where id=object_id('A'))
3、两个表字段名不一致的
select name from syscolumns where id=object_id('A') and name not in(select name from syscolumns where id=object_id('B'))
union
select name from syscolumns where id=object_id('B') and name not in(select name from syscolumns where id=object_id('A'))io