Thursday, March 22, 2012

comparing data between two tables...

I would like to compare data across two tables. I have part
information in a table. I get a new set of information periodically.
I would like to compare my new info to my old info. I recognize that
doing a compare of every attribute of every part will take FOREVER. Is
there some way I can do a "diff" based on the columns that I care
about?

Thanks!

--gloria"gloria" <gurbanic@.gmail.com> wrote in message
news:1108584926.680623.281960@.g14g2000cwa.googlegr oups.com...
>I would like to compare data across two tables. I have part
> information in a table. I get a new set of information periodically.
> I would like to compare my new info to my old info. I recognize that
> doing a compare of every attribute of every part will take FOREVER. Is
> there some way I can do a "diff" based on the columns that I care
> about?
> Thanks!
> --gloria

No idea - your desciption isn't very clear (to me), so I suggest you post
some CREATE TABLE and INSERT statements to show exactly what you want:

http://www.aspfaq.com/etiquette.asp?id=5006

But in general, you can do something like this:

select *
from dbo.MyTable1 t1 join dbo.MyTable2 t2
on t1.KeyColumn = t2.KeyColumn
where t1.col1 <> t2.col1
or t1.col2 <> t2.col2
or ... /* other columns here */

Simon|||Simon,

Your general code snippet tells me what I need to do. Thanks.

--gloria

ps. Thanks for the etiquette tip. I will do this in future. :)

No comments:

Post a Comment