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 2005 Forums
 Transact-SQL (2005)
 select query to get the missing rows

Author  Topic 

cplusplus
Aged Yak Warrior

567 Posts

Posted - 2009-07-02 : 10:50:06
I have a table in production with 1344 rows in it.

Now i have my local/development database has table, there i have 1348 rows.

I want to fire a query comparing both databases d1 & d2 pointing to my local/dev database against production db.

to get the missing rows list from my localdev db.

tablename is tablelabels, unique field is labelkey.

select * from db1.dbo.tablelabels d1
inner join db2.dbo.tablelabel d2 on
d1.LabelKey = d2.LabelKey

Thank you very much for the helpful info.

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2009-07-02 : 10:53:45
http://weblogs.sqlteam.com/peterl/archive/2009/06/12/Timings-of-different-techniques-for-finding-missing-records.aspx


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

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-07-02 : 11:29:46
is this for one time or do you want to synchronise b/w two dbs consistently?
Go to Top of Page

cplusplus
Aged Yak Warrior

567 Posts

Posted - 2009-07-02 : 11:30:21
perfect, Thanks a lot.
Go to Top of Page
   

- Advertisement -