Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 compare 2 tables

Author  Topic 

naveenbalraj
Starting Member

18 Posts

Posted - 2009-08-04 : 00:10:23
Hi All,

I have a scenario, where there are 2 identical tables. I call one as master table and the other as temp table.

The user will first download the information from the master table (as excel), make edits to the columns and can as well add new rows anywhere in the excel sheet and then upload. Now this upload will be inserted into the temp table (I have completed this far).

Now, I need to compare the fields in the master table with temp table and if there are any changes in the field, need to update those columns in the master table and if there is any new row, that as well need to be inserted into the master table.

I tried a way refered in another example, that I found googling. Where I had primary key to both the tables, and compared the 2 table using union. But this will not work for a scenario, where the user can insert a new row anywhere. So the comparison might fail with id to id match.

Do you guys have any direction, on how to implement this.

Thanks,
NB

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2009-08-04 : 00:29:30
duplicate http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=130573


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -