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
 General SQL Server Forums
 New to SQL Server Programming
 need help in merging database

Author  Topic 

noj17
Starting Member

18 Posts

Posted - 2008-12-03 : 02:10:39
hello..need help from pros out there, im a 2nd year student on o.j.t. and its my first time to tackle sql server, so forgive me if i got some terms incorrect.

there is an operating database, lets name it "bal". the database got corrupted and was backed up, reindexed and there was data loss. so now they created a new database, ("bal_new")for the normal transaction in the outlet. bal was sent to the dept for error testing. A backup/copy of "bal" was given to me and i was able to fix it without data loss. lets call the fixed db as "bal_fixed".now, my boss wants me to find out if it is possible to merge the new entries from bal_new to the original and fixed database bal_fixed?

any replies would be a great help!

thanks and more power!

darkdusky
Aged Yak Warrior

591 Posts

Posted - 2008-12-03 : 04:30:03
There are some tools on the internet but I haven't tested any. If you want to go through individual tables on the two databases:


--all rows in Table1 which do not match Table2
SELECT *
FROM Table1
except
select * from Table2



--all rows in Table2 which do not match Table1
select * from Table2
except
SELECT *
FROM Table1


--all rows in Table1 which MATCH Table2
SELECT *
FROM Table1
intersect
select * from Table2
Go to Top of Page
   

- Advertisement -