Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Transformation VB Script Expand / Collapse
Author
Message
Posted Monday, November 23, 2009 3:12 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Monday, November 23, 2009 3:11 PM
Points: 1, Visits: 0
Hello,

I am using Microsoft SQL Server 2000 and need some slight help in importing and transforming some data.

Below is the auto-generated script from Microsoft:

"Function Main()
DTSDestination("Code") = DTSSource("Col001")
DTSDestination("User_Cancel1") = DTSSource("Col002")
Main = DTSTransformStat_OK
End Function"

The first DTSDestination is the primary key of the database, and already has data in it. I want the script to find all matches between "Code" and "Col001", and then update "User_Cancel1" with "Col002".

If I run the script as is, I am given an error that it cannot insert duplicate data into the table.

I just want the script to FIND the first variable, and then update the second variable in the row.

I assume it's easy but I don't know VB well.

Thanks in advance.

--Mike Matthews
Post #823544
Posted Tuesday, November 24, 2009 1:17 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 2:35 AM
Points: 5,014, Visits: 10,517
I don't think this is a good Idea, Mike. The code you put in the transformation script is run for each row in the source table, so it would have to connect to the destination data source and issue a query for each row read from the source table.
I would copy the whole source table into a temporary table in the destination database and then match the rows with a set based query.

Hope this helps
Gianluca


--
Gianluca Sartori

Get your two-cent-answer quickly
spaghettidba.com
@spaghettidba
Post #823716
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse