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.
Author |
Topic |
TopsyKretts
Starting Member
6 Posts |
Posted - 2008-04-09 : 13:34:58
|
I was wondering if you can shed some light on an issue for me.I am a DTS package that is suppose to import a text file file daily. The issue is that that file has duplicate information is in. I have a primary key set up on my table that will not allow dups(as it should) the issue is that when the package runs it fails because the field will not allow dups nor the rest of the non dups to be inserted into the table....What step can I take to correct this? |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-04-09 : 14:16:29
|
One easy method is to export the file data as is on to a temporary staging table. Then use a Execute SQL task to insert distinct values from staging table onto destination table |
|
|
TopsyKretts
Starting Member
6 Posts |
Posted - 2008-04-09 : 14:19:20
|
Do you have a code example |
|
|
rmiao
Master Smack Fu Yak Hacker
7266 Posts |
Posted - 2008-04-09 : 22:26:21
|
Something like:insert into table select * from staging where key not in (select key from table) |
|
|
|
|
|