I have two tables in different databases that are exactly the same in structure.
I have added an additional column called test to tableA.
When I run the below code the NOT IN finds the difference between the tables (i.e. the additional column called test) but the NOT EXISTS doesn't - can anyone tell me why ?
[blue]DBomrrsm[/blue] ![[bandito] [bandito] [bandito]](/data/assets/smilies/bandito.gif)
[blue]Software code, like laws and sausages, should never be examined in production[/blue][black] - [/black][purple]Edward Tenner[/purple]
I have added an additional column called test to tableA.
When I run the below code the NOT IN finds the difference between the tables (i.e. the additional column called test) but the NOT EXISTS doesn't - can anyone tell me why ?
Code:
select *
From dev.Information_Schema.Columns
Where Table_Name = 'tableA'
and column_name not in
(select column_name
From smart.Information_Schema.Columns
Where Table_Name = 'tableA')
select *
From dev.Information_Schema.Columns
Where Table_Name = 'tableA'
and not exists
(select *
From smart.Information_Schema.Columns
Where Table_Name = 'tableA')
![[bandito] [bandito] [bandito]](/data/assets/smilies/bandito.gif)
![[bandito] [bandito] [bandito]](/data/assets/smilies/bandito.gif)
[blue]Software code, like laws and sausages, should never be examined in production[/blue][black] - [/black][purple]Edward Tenner[/purple]