January 20, 2011 at 3:49 pm
The first step in my SSIS package is a Script Task with the following C# code:
public void Main()
{
Dts.Variables["User::OutputFile"].Value = Dts.Variables["User::OutputPath"].Value + DateTime.Now.ToString() + ".xlsx";
Dts.TaskResult = (int)ScriptResults.Success;
}
The problem is that the OutputFile is not actually updated after that step and no errors are reported.
The OutputFile and OutputPath variables are defined in the Package scope and in the ReadWrite parameters of the Script Task. They do not show up twice in the package container, as I've heard that is usually the problem.
Any ideas why that variable isn't updating in the package?
Thanks.
--Andrew
January 20, 2011 at 3:57 pm
So as I read that you only have them defined at the package level, NOWHERE else, not in any other containers nothing.. You might add a call to a msgbox to display the pre and post value of the variable just to see that it is actually getting set in the script. Obviously that is only for debug. What you describe *should* work.. Is the value just not getting changed or is it blanked or what is it showing?
CEWII
January 20, 2011 at 4:10 pm
As far as I can tell that variable only exists at the package level. The variable is an empty string to begin with and after the script step runs, it remains the same.
I'm new to SSIS development, so I could be missing something. My understanding is that if I click on the script step so that it's selected the Variables pane would show additional variables that apply to that step, correct? If so, the variables pane does not change if I click on an empty space vs the script task step.
I've done debugging and put breaks before the actual value assignment. Originally it shows '' and after it shows the correct concatenated string I want. But the variable pane does not change.
January 20, 2011 at 4:12 pm
Additionally, if I click the ""Show all variables" button in the variables pane, nothing changes. I only have three variables in the entire package and they are all uniquely named.
January 21, 2011 at 12:50 am
No matter what happens to a variable while the package runs, when you look at the variable values in the variables pane, you will always see its initial setting, which should be regarded as its default value, nothing more. This is standard behaviour.
To check the value of your variable while the package is running, you can use message boxes, data viewers etc.
January 21, 2011 at 8:26 am
Ahhh.... My mistake, I though those would update during execution. I did a message box and it does in fact update. I think I see the real failure point with the string I'm putting in the variable. Thanks for the help.
January 21, 2011 at 8:39 am
A pleasure to help.
January 21, 2011 at 9:24 am
Good idea Phil.. So it was updating but he expected the variable tab to show the updates.. I'll file that one away..
CEWII
January 21, 2011 at 9:31 am
Nice catch Phil
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
Viewing 9 posts - 1 through 9 (of 9 total)
You must be logged in to reply to this topic. Login to reply