Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Transformation VB Script


Transformation VB Script

Author
Message
mykleisyomomma
mykleisyomomma
Forum Newbie
Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)

Group: General Forum Members
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
Gianluca Sartori
Gianluca Sartori
SSCertifiable
SSCertifiable (6.9K reputation)SSCertifiable (6.9K reputation)SSCertifiable (6.9K reputation)SSCertifiable (6.9K reputation)SSCertifiable (6.9K reputation)SSCertifiable (6.9K reputation)SSCertifiable (6.9K reputation)SSCertifiable (6.9K reputation)

Group: General Forum Members
Points: 6858 Visits: 13323
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

How to post T-SQL questions
spaghettidba.com
@spaghettidba
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