dbTalk Databases Forums  

How to bulk insert from DB into another DB

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss How to bulk insert from DB into another DB in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
CENK
 
Posts: n/a

Default How to bulk insert from DB into another DB - 03-02-2006 , 11:19 AM






hi,

i have 2 huge DBs, lets say DB1 has 30,000,000 rows and DB2 has 6,000,000
rows. I wanna bulk insert datas from DB2 into DB1 but there are common datas
so, i only want to insert DISTICT datas. How can i do this in a very very
fast way?

thanks
--
One by one they all went down

Reply With Quote
  #2  
Old   
Philippe Lacoude
 
Posts: n/a

Default Re: How to bulk insert from DB into another DB - 03-02-2006 , 03:07 PM






Hi Cenk,

You can
1) bulk copy the 30m-row table of DB1 into a temporary table in DB2,
2) do a join between the temporary table and the 6m-row in DB2
3) insert the joined data into the 6m-row in DB2

To speed things up, you can build an index on the new table as part as a
step 2b.

Even if you do not have permission to create a table in DB2, you should have
permission to create a temporary table. (Temp tables start with # in T-SQL
DDL.) Even the `datareader' role has permission to create a temp table, I
believe.

The only danger is that if you are working at a major corporation that uses
solid state drives to store the temporary SQL Server database (tempdb) you
run the risk of overflowing your drive. This should really be an issue in
less than 1% of all enterprise implementations.

Good luck,

Philippe Lacoude


"CENK" <CENK (AT) discussions (DOT) microsoft.com> wrote

Quote:
hi,

i have 2 huge DBs, lets say DB1 has 30,000,000 rows and DB2 has 6,000,000
rows. I wanna bulk insert datas from DB2 into DB1 but there are common
datas
so, i only want to insert DISTICT datas. How can i do this in a very very
fast way?

thanks
--
One by one they all went down



Reply With Quote
  #3  
Old   
CENK
 
Posts: n/a

Default Re: How to bulk insert from DB into another DB - 03-02-2006 , 05:22 PM



Well actually i should have told that NOT COMMON data, but the SAME data.
like i said before, there are some SAME rows in two tables! thats why i dont
want to insert the same data again and again.

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.