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)
 How to get the difference between two tables quickly?

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-06-05 : 09:08:22
Daniel writes "I have two almost identical tables, one in staging database, another one in production database. Both of them are over 2.5 million records. However, the staging database table have about 70 more records than production table. Both table have one unique field.

I try use subquery like: select * from staging_table where id not in (select id from production_table). This is very expensive in memory useage and runs very slow.

I called my friends who is a Oracle guru. He said in Oracle, the query is like " (select * from staging_table) - (select * from production_table)". However, this approach does not work in SQL7.

Is there any way like as Oracle did, pulling out the difference quickly from SQL7?

Thanks a lot

Daniel"
   

- Advertisement -