script task: there should be another way to select variables than the comma seperated list
One has to type in a whole list of variables, hoping not to make any mistakes
IntelliSense for example?
But hey, I'm not complaining...
greets
There is! You can do it in code.
Writing to a variable from a script task
(http://blogs.conchango.com/jamiethomson/archive/2005/02/09/964.aspx)
Still no intellisense though!!
I highly recommend you use the code option because this minimises the risk of variable locking. I plan to blog about this soon and have written about it in an upcoming article in SQL Server Standard.
-Jamie
|||
ok, I'll do it your way
thanks
|||Dear Jamie,
Your method works fine for 1 variable.
I assume you know this, but for other readers of this thread:
ms-help://MS.VSCC.v80/MS.VSIPCC.v80/MS.SQLSVR.v9.en/dtsref9mref/html/T_Microsoft_SqlServer_Dts_Runtime_VariableDispenser.htm
quoting:
There are two scenarios for using the variable dispenser.
You want just one variable. In this scenario, call LockOneForRead or LockOneForWrite, and a collection with one element is returned.
You want several variables. In this scenario, call LockForRead and LockForWrite several times, one for each variable. This builds up two lists, one list that contains variables for reading and a list of variables for writing. Next, call GetVariables, which gives you a collection that contains all of the locked variables. If GetVariables succeeds, the two lock lists, which are the lists of variable names, not actual locks, is cleared.
To clear the locks, call Unlock on the collection when finished to explicitly release the locks. This unlocks the variables themselves. If GetVariables fails, the lists remain unchanged, and you can call GetVariables again. If you still do not succeed, call Reset to clear the lists and bring the variable dispenser back to its initial state.
Cheers,
Tom
No comments:
Post a Comment