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 Veteran
SSC Veteran (248 reputation)SSC Veteran (248 reputation)SSC Veteran (248 reputation)SSC Veteran (248 reputation)SSC Veteran (248 reputation)SSC Veteran (248 reputation)SSC Veteran (248 reputation)SSC Veteran (248 reputation)

Group: General Forum Members
Points: 248 Visits: 158
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
Mr or Mrs. 500
Mr or Mrs. 500 (552 reputation)Mr or Mrs. 500 (552 reputation)Mr or Mrs. 500 (552 reputation)Mr or Mrs. 500 (552 reputation)Mr or Mrs. 500 (552 reputation)Mr or Mrs. 500 (552 reputation)Mr or Mrs. 500 (552 reputation)Mr or Mrs. 500 (552 reputation)

Group: General Forum Members
Points: 552 Visits: 266
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 Veteran
SSC Veteran (248 reputation)SSC Veteran (248 reputation)SSC Veteran (248 reputation)SSC Veteran (248 reputation)SSC Veteran (248 reputation)SSC Veteran (248 reputation)SSC Veteran (248 reputation)SSC Veteran (248 reputation)

Group: General Forum Members
Points: 248 Visits: 158
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