SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Check for table constraints using ssis packages


Check for table constraints using ssis packages

Author
Message
rahulsahay123
rahulsahay123
SSC Rookie
SSC Rookie (39 reputation)SSC Rookie (39 reputation)SSC Rookie (39 reputation)SSC Rookie (39 reputation)SSC Rookie (39 reputation)SSC Rookie (39 reputation)SSC Rookie (39 reputation)SSC Rookie (39 reputation)

Group: General Forum Members
Points: 39 Visits: 153
I am having 2 tables. source table and target table ie

create table tableA
(
id integer
,fname varchar(20)
,lname varchar(20)
)

And

create table tableB
(
id integer
,fname varchar(20)
,lname varchar(20) not null
)

Sample data:
TableA
1,'a','aa'
2,'b',null

So using packages when I am inserting data from tableA to tableB then package will fail for null records of tableA (fname) as fname cannot be null in destination table.

How to make sure that packages run fine and the bad data is stored in error_table. Meaning tableB will have only 1 record and 1 record should go to error_table and package should execute successfully.

Thanks
Maxime.Gagne
Maxime.Gagne
SSC Veteran
SSC Veteran (229 reputation)SSC Veteran (229 reputation)SSC Veteran (229 reputation)SSC Veteran (229 reputation)SSC Veteran (229 reputation)SSC Veteran (229 reputation)SSC Veteran (229 reputation)SSC Veteran (229 reputation)

Group: General Forum Members
Points: 229 Visits: 252
Hello,

There are a few possibilities, here would be the most obvious two:

1) Use a Conditional Split before your Insert to evaluate your NULLs and send them to Error_table

2) Use the Error Output of the Destination Component to forward the rows in errors to your Error_Table
rahulsahay123
rahulsahay123
SSC Rookie
SSC Rookie (39 reputation)SSC Rookie (39 reputation)SSC Rookie (39 reputation)SSC Rookie (39 reputation)SSC Rookie (39 reputation)SSC Rookie (39 reputation)SSC Rookie (39 reputation)SSC Rookie (39 reputation)

Group: General Forum Members
Points: 39 Visits: 153
Thanks for the ReplySmile
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search