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 |
sanjepau
Starting Member
5 Posts |
Posted - 2009-07-20 : 10:39:05
|
Hi All,My requirement is something like this.In my SSIS package there will be Flat file source and two destination tables,one will be as Vallid table and the other will be as Error table.There will be some mandatory columns in the records coming from the Source now my requirement is to check whether the mandatory column is blank or not i.e. I have to iterate through all the rows.If any of the mandatory column is blank then the file will be considered as corrupt and it should re-direct all the rows (coming from Source) to Error table,not a single row should go to Valid table.If I am using Conditional Split then I can't re-direct all the rows to Error table rather only that particular row will go.Please guide me in completing this package successfully.Any help will be highly appreciated.Sanjeev |
|
vijayisonly
Master Smack Fu Yak Hacker
1836 Posts |
Posted - 2009-07-20 : 16:01:34
|
One way is you can load everything into a stage table. And use an SQL task with the staging table to insert into your tables.Am not sure if this is the best way.IF EXISTS (SELECT * FROM staging_table WHERE column1 IS NULL) BEGIN INSERT INTO error_table SELECT * FROM staging_table END ELSE BEGIN INSERT INTO valid_table SELECT * FROM staging_table END |
 |
|
|
|
|