dbTalk Databases Forums  

DTS Package Duplicate Checking

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


Discuss DTS Package Duplicate Checking in the microsoft.public.sqlserver.dts forum.



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

Default DTS Package Duplicate Checking - 09-09-2004 , 10:25 AM






Hi All,

I currently have a DTS package that imports records from a text file into a
table. However, occasionally the text file has duplicate records in it.
When this occurs, the DTS package will fail and due to primary key
constraints on the table. To solve the problem, I need to go into the text
file and remove the offending records.

My question is, can a DTS package be set up to ignore duplicate records, or
must this step be performed at the table level? Right now, the steps
involved in getting the records to the live table are as follows:

1) Download text file from an FTP site
2) Import the records via a DTS package to a temporary table (while
observing the primary key constraints).
3) Move the records from the temp table to a live table only when the record
is not duplicated in the live table
4) Delete all records out of the temp table

I was thinking about removing the primary key constraints from the temporary
table, but I'm wondering if I would get an "ambiguous record" error when I
selected these records from the table and tried to insert them into the live
table.

Does anyone have any ideas?

Thanks!

Brian.



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

Default Re: DTS Package Duplicate Checking - 09-09-2004 , 02:38 PM






Personally that's how I would do it.

Import to staging table.
Remove duplicates based on your criteria.
Move to real table

--
--

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


"Brian Piotrowski" <bpiotrowski (AT) NOSPAM (DOT) simcoeparts.com> wrote

Quote:
Hi All,

I currently have a DTS package that imports records from a text file into
a
table. However, occasionally the text file has duplicate records in it.
When this occurs, the DTS package will fail and due to primary key
constraints on the table. To solve the problem, I need to go into the
text
file and remove the offending records.

My question is, can a DTS package be set up to ignore duplicate records,
or
must this step be performed at the table level? Right now, the steps
involved in getting the records to the live table are as follows:

1) Download text file from an FTP site
2) Import the records via a DTS package to a temporary table (while
observing the primary key constraints).
3) Move the records from the temp table to a live table only when the
record
is not duplicated in the live table
4) Delete all records out of the temp table

I was thinking about removing the primary key constraints from the
temporary
table, but I'm wondering if I would get an "ambiguous record" error when I
selected these records from the table and tried to insert them into the
live
table.

Does anyone have any ideas?

Thanks!

Brian.





Reply With Quote
  #3  
Old   
Ilya Margolin
 
Posts: n/a

Default Re: DTS Package Duplicate Checking - 09-10-2004 , 11:20 AM



Brian,

One way to do it is to set the temp table with a unique index and ignore
duplicates option.

Ilya

"Brian Piotrowski" <bpiotrowski (AT) NOSPAM (DOT) simcoeparts.com> wrote

Quote:
Hi All,

I currently have a DTS package that imports records from a text file into
a
table. However, occasionally the text file has duplicate records in it.
When this occurs, the DTS package will fail and due to primary key
constraints on the table. To solve the problem, I need to go into the
text
file and remove the offending records.

My question is, can a DTS package be set up to ignore duplicate records,
or
must this step be performed at the table level? Right now, the steps
involved in getting the records to the live table are as follows:

1) Download text file from an FTP site
2) Import the records via a DTS package to a temporary table (while
observing the primary key constraints).
3) Move the records from the temp table to a live table only when the
record
is not duplicated in the live table
4) Delete all records out of the temp table

I was thinking about removing the primary key constraints from the
temporary
table, but I'm wondering if I would get an "ambiguous record" error when I
selected these records from the table and tried to insert them into the
live
table.

Does anyone have any ideas?

Thanks!

Brian.





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.