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
 SSIS and Import/Export (2005)
 newbee: copy data from table1 to table2?

Author  Topic 

coorgun
Starting Member

10 Posts

Posted - 2009-10-07 : 09:49:38
ms sql server 2005 + visual studio 2005:

i want to copy the customer data from the productive table srcCustomer into a dimension table dimCustomer; dimCustomer.customerID is unique.

i created a vary simple ssis package:
OLE DB source -> OLE DB destination.

my problem:
the first load is ok, but after the first load dimCustomer already has some customerIDs from srcCustomer and the load fails.

what can i do? how can i achieve that only the rows should be loaded into dimCustomer which are not already there?


thx, best regards,
coorgun

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2009-10-07 : 10:05:41
truncate destination before inserting?


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

coorgun
Starting Member

10 Posts

Posted - 2009-10-07 : 10:10:00
quote:
Originally posted by webfred

truncate destination before inserting?



sorry, but i don't know what you mean - a really newbee ...
Go to Top of Page

YellowBug
Aged Yak Warrior

616 Posts

Posted - 2009-10-07 : 10:11:19
Or create/alter an index on dimCustomer.customerID with IGNORE_DUP_KEY
Go to Top of Page

coorgun
Starting Member

10 Posts

Posted - 2009-10-07 : 10:16:42
quote:
Originally posted by YellowBug

Or create/alter an index on dimCustomer.customerID with IGNORE_DUP_KEY



but i don't want to have double values in my dimension table.

i want to periodically run this package to add new customers from srcCustomer to dimCustomer
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2009-10-07 : 10:18:58
I mean: have a look at the properties in your task to choose something like "empty destination table" instead of "append to ...".


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

coorgun
Starting Member

10 Posts

Posted - 2009-10-07 : 10:21:48
quote:
Originally posted by webfred

I mean: have a look at the properties in your task to choose something like "empty destination table" instead of "append to ...".



understand, thank you.

is it "best practice" to work like that? won't i waste ressources?
Go to Top of Page

coorgun
Starting Member

10 Posts

Posted - 2009-10-07 : 10:38:59
quote:
Originally posted by webfred

I mean: have a look at the properties in your task to choose something like "empty destination table" instead of "append to ...".



my package is very easy: i just connected one OLE DB source to an OLE DB destination.

and i can't find anything like "empty destination table" ...
Go to Top of Page
   

- Advertisement -