July 29, 2010 at 3:39 am
Hi,
Im having a problem where i am trying to load a text file (csv) into a SQL Server 2005 Database.
This file has a problem in row 306. I have a OLE DB Destination Task which does the importing part, however it will import 305 rows, and then fail the import.
Is there any way to make it not import any rows, or roll back what it has already imported when it throws an error.
Background.
I have 10 files i want imported, so i am using a for each loop, to go though each file and try to import it into SQL Server database table.
The loop, checks to see file exists, if it exists, uses flat file source task to get the file, a derived column task to reformat teh data a little, then an OLE DB Destination task to import the data.
If any Flat file source, Derived column or OLE DB destination fails, it will move to the next task.
If any of these fail,the package returns Fail on completion. is there any way to prevent this?
Thanks in adavance
August 1, 2010 at 10:00 am
If you open the OLE DB Destination component dialog, there is a selection called "Error Output". The default is to fail the component, in case of errors. You can change to "Redirect row" and then insert the error row into appropriate table. You can then check this table and take the required action.
August 2, 2010 at 2:19 am
Thanks for the reply Cozy.
I was hopeing to totaly abort the import if there was a problem rather then just redirect the error rows. So if there is a problem with the file it is trying to import it should not import anything at all.
I would have thought this would be possible but cant see an option or it.
August 2, 2010 at 6:23 am
f.khan (8/2/2010)
Thanks for the reply Cozy.I was hopeing to totaly abort the import if there was a problem rather then just redirect the error rows. So if there is a problem with the file it is trying to import it should not import anything at all.
I would have thought this would be possible but cant see an option or it.
Yes, it is possible. Have the load process inside transaction and in case you have issues with some records, the entire load will be aborted.
August 2, 2010 at 7:11 am
i'm not sure what you mean there Cozy.
Currently the load process is inside a dataflow task.
August 2, 2010 at 7:18 am
August 2, 2010 at 7:23 am
the instructions for a database to execute a job?
I dont have a lot of experience in database design and SQL Server and how it works behind the scenes. I am currently using SQL server 2005, and have only recently started using it.
August 2, 2010 at 7:33 am
August 2, 2010 at 7:34 am
f.khan (8/2/2010)
the instructions for a database to execute a job?I dont have a lot of experience in database design and SQL Server and how it works behind the scenes. I am currently using SQL server 2005, and have only recently started using it.
I would recommend you find a good book about relational databases. The transactions are very important part . In simple terms the transaction process allows you to send a set of commands to the database and the engine will make sure all these commands are either committed "as one" or no change takes place.
Perhaps other forum readers can suggest good books about the topic?
Viewing 9 posts - 1 through 9 (of 9 total)
You must be logged in to reply to this topic. Login to reply