I'm new to the whole DTS scene and not impressed with the info I'm finding. Here's what I'm trying to do:
I have two recordsets generated by ExecteSQLTasks (created as output global variables). While I'm looping through one recordset in a script I would like to do data-driven updates of the second recordset based on data in the first. This seemed easy at first. I thought I could just do a little hoochie coochie:
Dim objPackage
Dim objTask
Dim objCustomTask
Set objPackage = DTSGlobalVariables.Parent
For each objTask in objPackage.Tasks
If objTask.CustomTask.Description = "The description I gave it!" Then
objTask.Properties("SQLStatement").Value = "My new SQL statement"
objTask.Execute
End If
And voila! I'd have my new recordset established as a new value for the global variable. But no! It doesn't seem to work that way. What's up with this?
FYI, I also tried to apply filters to the original recordset using:
rs.Filter = " table.field = " & varMyDataNotAString
But that didn't work either. Grrrr!
Anybody out there doing things like this and getting them to work?
Thanks!Check SQLDTS (http://www.sqldts.com) website and search for GLOBAL VARIABLES which will show code examples to use so.
HTH|||Actually, I'm pretty sure this is where I originally got the code in my initial post. The issue is that using this code did not refresh my global variable (and hence my recordset). I could change the SQL statement, but either the Task doesn't actually execute with the
objTask.CustomTask.Execute
or somehow the global variable isn't refreshed.
I plan to continue playing with it today.
Thanks for your reply!
No comments:
Post a Comment