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)
 Importing Error

Author  Topic 

Karna
Starting Member

4 Posts

Posted - 2007-06-01 : 01:33:32
Hi all



My job is to create an import wizard in SQL Server 2005 the details as follows

I have a CSV data file from this data file has to be imported to a table in SQL Server 2005, but in this data file we have duplicate records which should not be imported to a table. I am importing this from using flat file object to a table, if I create table prior implementation with primary keys I could not able to import any data, if I remove primary key from the table it’ll easily get imported.

My question is how can ensure validations if at all it has primary key, suppose if I have around 100 records somewhere near 70 duplicate record is there, let it import all the records & throw error in log file saying that 70 record could not be imported because of primary key in the table.



Please suggest me to solve.


Thanks in advance,

Karna

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-06-01 : 01:38:42
Import all data as it is in a staging table and then process staging table to import only unique records to final table.

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page
   

- Advertisement -