I don't know how to combine workflow script and task script together
I just use the example in
http://sqldts.com/?246 and replace the connection stuff into step 2's task script. I could display the correct recordset values one by one. However, the data pump connection can only be completed at the last recordset. ie. I've 2 records in recordset. Only the last record's data are transformed to the destination location. I've also set the workflow properties's option = close connection on completion. What's the problem ? Do I need to add some steps or scripts to link up the connection
- replace e.g. 298 step 2's task scrip
Function Main(
Dim oR
Dim oConn, oConn1
Dim oPkg, oDataPum
Set oRS = DTSGlobalVariables("RSTables").Valu
Set oPkg = DTSGlobalVariables.Paren
MsgBox "Dest. DB:" & vbCrLf & oRS.Fields(4).Value & vbCrLf ' show correct value
Set oConn1 = DTSGlobalVariables.Parent.Connections("SQL Server 2"
oConn1.DataSource = Trim(oRS.Fields(0).Value) ' source server
oConn1.Catalog = Trim(oRS.Fields(1).Value) ' source D
Set oConn = DTSGlobalVariables.Parent.Connections("Sybase 1"
oConn.DataSource = Trim(oRS.Fields(3).Value) ' dest. Serve
oConn.Catalog = Trim(oRS.Fields(4).Value) ' dest. D
Set oDataPump = oPkg.Tasks("DTSTask_DTSDataPumpTask_1").CustomTas
oDataPump.SourceObjectName = Trim(oRS.Fields(2).Value) ' source table
oDataPump.DestinationObjectName = Trim(oRS.Fields(5).Value) ' dest. tabl
Set oDataPump = Nothin
Set oConn = Nothin
Set oConn1 = Nothin
oRS.MoveNex
Set oRS = Nothin
Main = DTSTaskExecResult_Succes