dbTalk Databases Forums  

overwrite existing record

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


Discuss overwrite existing record in the microsoft.public.sqlserver.dts forum.



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

Default overwrite existing record - 10-18-2004 , 12:55 PM






how do i tell my dts package transform data task to overwrite already
existing records with new ones? I already truncated the table and am
inserting about 80000 records, but maybe 63 of them are duplicates. I get a
primary key contraint violation, but i need to have the primary key. On
resume next just skips the record, but i need it to overwrite the previously
inserted one.

I've looked all over for an answer but nothing relevant.... any ideas?

--
andrew
agale10495 (AT) aol (DOT) com



Reply With Quote
  #2  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: overwrite existing record - 10-18-2004 , 02:15 PM






Oooh

The DataPump task is not really designed for this.

You can use Lookups. You would need to test for the existence of the PK and
if it existed then UPDATE all non PK attributes ELSE insert the new row.

This might be slow because Lookups are Row * Row

How large is the source dataset?

--
--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.konesans.com - Consultancy from the people who know


"Andrew Gale" <AGale10495 (AT) aol (DOT) com> wrote

Quote:
how do i tell my dts package transform data task to overwrite already
existing records with new ones? I already truncated the table and am
inserting about 80000 records, but maybe 63 of them are duplicates. I get
a primary key contraint violation, but i need to have the primary key. On
resume next just skips the record, but i need it to overwrite the
previously inserted one.

I've looked all over for an answer but nothing relevant.... any ideas?

--
andrew
agale10495 (AT) aol (DOT) com




Reply With Quote
  #3  
Old   
Andrew Gale
 
Posts: n/a

Default Re: overwrite existing record - 10-18-2004 , 04:13 PM



about 80,000 records. I was originally doing it the way you said, but the
package was taking 13 min.

I'm now using a bulk insert to a temp table, then using sql to compare and
make insert/updates between tables.

The package now takes about 3 or 4 minutes, so i'm happy.

Thanks for the info.....

--
andrew


"Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote

Quote:
Oooh

The DataPump task is not really designed for this.

You can use Lookups. You would need to test for the existence of the PK
and if it existed then UPDATE all non PK attributes ELSE insert the new
row.

This might be slow because Lookups are Row * Row

How large is the source dataset?

--
--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.konesans.com - Consultancy from the people who know


"Andrew Gale" <AGale10495 (AT) aol (DOT) com> wrote in message
news:O2q5nuTtEHA.3556 (AT) TK2MSFTNGP10 (DOT) phx.gbl...
how do i tell my dts package transform data task to overwrite already
existing records with new ones? I already truncated the table and am
inserting about 80000 records, but maybe 63 of them are duplicates. I
get a primary key contraint violation, but i need to have the primary
key. On resume next just skips the record, but i need it to overwrite
the previously inserted one.

I've looked all over for an answer but nothing relevant.... any ideas?

--
andrew
agale10495 (AT) aol (DOT) com






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.