需要包括有几种情况
一、A表中有的字段B表无
二、B表有的A表无
三、两个表字段名不一致的

------------------------------------------------------------------------

如果只对比字段名,可以这样

一、A表中有的字段B表无
select name from syscolumns where id=object_id('A') and name not in(select name from syscolumns where id=object_id('B'))
二、B表有的A表无
select name from syscolumns where id=object_id('B') and name not in(select name from syscolumns where id=object_id('A'))
三、两个表字段名不一致的
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'))
 

相关文章:

  • 2022-12-23
  • 2021-11-22
  • 2022-12-23
  • 2021-08-07
  • 2021-09-21
  • 2021-08-21
猜你喜欢
  • 2021-12-01
  • 2022-03-09
  • 2021-12-19
  • 2021-09-09
  • 2022-12-23
  • 2022-12-23
  • 2021-08-03
相关资源
相似解决方案