dbTalk Databases Forums  

Write rejected records into SQL Table

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss Write rejected records into SQL Table in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
yakhkindl@tycohealthcare.com
 
Posts: n/a

Default Write rejected records into SQL Table - 02-09-2004 , 03:38 PM






Hi,

I am importing data using DTS from .csv file into SQL table -Table_with_Good_records.
SQL table has constrains on some column.

How can I write rejected records (didn't pass conditions, duplicate PK, etc) into the another SQL table - Table_with_Rejected_records.

Thank you.
Leon

************************************************** ********************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...

Reply With Quote
  #2  
Old   
Darren Green
 
Posts: n/a

Default Re: Write rejected records into SQL Table - 02-10-2004 , 03:18 AM






You could do this with a Data Driven Query (DDQ) task. You would use lookups
in the transformation script to check for PK violations and other such
tests. If all is well pass in to the INSERT query, otherwise pass it to the
UPDATE query. Whilst DDQ has named queries, these do not have to have
statements that match the name, so both the Insert and Update named queries
can run inserts,or deletes, or even selects for that matter.

To be honest this is often easier if you just import the data as is into a
staging table, then use regular SQL to populate the final table, or the
reject table or anything else that is required.


--
Darren Green
http://www.sqldts.com


"Leo Yakh" <yakhkindl (AT) tycohealthcare (DOT) com> wrote

Quote:
Hi,

I am importing data using DTS from .csv file into SQL
table -Table_with_Good_records.
SQL table has constrains on some column.

How can I write rejected records (didn't pass conditions, duplicate PK,
etc) into the another SQL table - Table_with_Rejected_records.

Thank you.
Leon

************************************************** ********************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP &
ASP.NET resources...




Reply With Quote
  #3  
Old   
yakhkindl@tycohealthcare.com
 
Posts: n/a

Default Re: Write rejected records into SQL Table - 02-10-2004 , 05:40 PM



Thank you Darren.
I'll try to use DDQ (for the first time).

************************************************** ********************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.