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)
 Import of a .csv file

Author  Topic 

lemondash
Posting Yak Master

159 Posts

Posted - 2008-11-27 : 07:14:03
Morning,
I have got an SSIS package that I have a small issue with. All I have is a flat file with three data columns which I pick on a daily basis from an ftp site and insert the data in to live table.
The problem I have is that some of the date may all ready be in the table and because the table doesn’t allow duplicates there is a violation error message and also there is a foreign key constraint as well which will give an error. But I still want to process the valid data and if at all possablile put the error data in a separate table.
I did find a work around by importing the data in to a staging table and then inserting the data via a cursor which works but is a very messy way of doing this. I also try putting a try/catch in the cursor to get the error rows to insert but it got its self stuck in a loop.
So any help with this would be great!!!
Regards

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-11-27 : 07:53:27
You can use a lookup to determine if date already is in table.



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-11-27 : 08:22:17
You can use Lookup Transformation task in SSIS and if finds matches error the output to different table.
Go to Top of Page
   

- Advertisement -