Can DTS write exceptions to a database table? In the code
below, I copy fname, lname and (at the end) company from
the source to the destination. However, with title, if the
title is executive or president, the title is copied over;
if the title is ceo it is entered into the destination
table as ceo/chairman; if none of these conditions apply
(i.e. title is owner) I want the entire row written to a
new table.
If I use Main = DTSTransformStat_SkipRow, rows that meet
the title criteria are entered into the destination table,
and the rows that don't meet the criteria are not entered.
I can get DTS to output the exeption file to a text file,
however, with the large number of records that don't meet
the criteria, it would be better to have them in a new
table.
Thanks,
Jay
----------
Function Main()
DTSDestination("fname") = DTSSource("fname")
DTSDestination("lname") = DTSSource("lname")
'Check Titles
If lcase(DTSSource("title")) = "executive" then
DTSDestination("title") = DTSSource("title")
ElseIf lcase(DTSSource("title")) = "president" then
DTSDestination("title") = DTSSource("title")
ElseIf lcase(DTSSource("title")) = "ceo" then
DTSDestination("title") = "CEO/Chairman"
Else
Main = DTSTransformStat_ExceptionRow
'Main = DTSTransformStat_SkipRow
Exit Function
End if
DTSDestination("company") = DTSSource("company")
Main = DTSTransformStat_OK
End FunctionYou can break your task in 2 phases:
First Transformation Task:
Insert / Update all rows that meet the criteria
Second Transformation Task:
Insert rows that does not meet the criteria in a anther table
Remeber the you can have more than one transformatrion task between two connections|||Thanks - I will give that a try.
No comments:
Post a Comment