Change SSIS variable with reference in C# ?

  • I access a read write variable with C# in script task. Its Dts.Variables["strRope"].Value = "onFire";

    Is there any way I could refer to a SSIS variable without using this big name ? I was thinking of -

    Object var = Dts.Variables["strRope"].REFERENCE_TO_VARIABLE;

    Now, if I want to reassign strRope, I can simply say var = (String) "Ten thousand thundering typhoons".

    Is there any way I can do such a thing ?

  • In script component you have to initialize the variable by using DTS.Variables class. you can declare a variable within script component and assign the value as far my knowledge there is no way not to use long name for package variable.

    Abhijit - http://abhijitmore.wordpress.com

  • No. Passing in and out of the variables set in SSIS is byVal only. You need to use the long name. If you're going to manipulate it a lot, I usually set a local variable to the DTS.Variables("SomeVariable").value, sometimes with .toString if necessary, manipulate it, and then set it back at the end.


    - Craig Farrell

    Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.

    For better assistance in answering your questions[/url] | Forum Netiquette
    For index/tuning help, follow these directions.[/url] |Tally Tables[/url]

    Twitter: @AnyWayDBA

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply