ssis 2008, Parameter on Script Component? - ssis

I'm working on SSIS 2008.
On the Control Flow of my ssis I have an Execute SQL Task which connects to a Data Flow Task giving the Data Flow Task a value on a variable.
On the Data Flow Task I have a Script Component which would have an sql query and the sql query would work with the variable value.
I want the Script Component to "receive" or "take" the variable as a parameter so I can work with the parameter value.
What I want is something like an OLE DB Source has: If one double clicks on the Ole Db Source and put Sql Command on Data Access mode, you can see the Parameters button, and there you can put the parameter and assign a variable to the parameter.
I have tested the Script Component options, but until now I have not seen a functionality like Ole DB Source has.
How can I do this with a Script Component?
Thanks.

If you're using an OLE DB Source component, you should be able to map parameters just like you do in an Execute SQL Task. Simply use a ? as the variable placeholder.
If you are using an ADO.NET connection, it's more painful as the parameters must be mapped outside of the actual data flow. See this answer for more detail.
If you have a pressing business need for using the Script Component, then by all means use it. Click the ellipses on the ReadOnlyVariable property of the Script Transformation Editor window.
In the resulting window, scroll down and check all the variables you will need access to.
Now in your Script Task you will be able to reference those variables. The syntax should be something like this.ComponentMetadata.Variables.MyVariableName

Related

How to use parameter to set the path for script task SSIS

I need to set the directory path in the script task component in SSIS package.
I am using Visual Studio 2008 to build the SSIS package inside that I have one action where in i need to create the folder hierarchy.
Instead of hard coding I need to set with parameter so that when they run the package they can change the folder path.
where I can set the parameter to perform dynamic action.
string _FileDirectory = #"C:/EPLInterface/PPSExtractor/";
Also how to access the created parameter in visual studio 2008 to build the package.
Create a variable in the control Flow like below
once you create variable open the script editor and add the variable u created some thing like below
note* : Variable what you have created will automatically appear here.
Then Click on Edit Script and access the variable as below:
if (Dts.Variables["User::FilePath"].Value !=null && !string.IsNullOrEmpty(Dts.Variables["User::FilePath"].Value.ToString()))
{
_FileDirectory = Dts.Variables["User::FilePath"].Value.ToString() + "\\";
}
If you want to change this path Dynamically you can do it something like below:
dtexec /FILE "C:\Users\kata\Desktop\ExtractData.dtsx" /Set \Package.Variables[User::FilePath].Properties[Value];"C:\Newpath"
Also you can change when u run the SSIS package as below:
You can use a package level variable. Variables can be set by the user at run time and read by your script task.

In SSIS can we route a Lookup Error Output to a Flat File Destination and simultaneously activate the OnError event

In an SSIS Data Flow Task (SSDT 2008 R2) I would like to route a Lookup Error Output to a Flat File Destination and simultaneously I would like to activate the OnError event handler to execute a Script Component to do other things (get the ErrorDescription). It seems that we can't have the both? Bachir
What I do is use a "Multicast" to take the lookup error output and send it to the flat file and also a Script Component which gives you the same effect.
ed

How to do File System Task in SSIS depending on Result of Data Flow

I'm writing a (what I thought to be a) simple SSIS package to import data from a CSV file into a SQL table.
On the Control Flow task I have a Data Flow Task. In that Data Flow Task I have
a Flat File Source "step",
followed by a Data Conversion "step",
followed by a OLE DB destination "step".
What I want to do is to move the source CSV file to a "Completed" folder or to a "Failed" folder based on the results of the Data Flow Task.
I see that I can't add a File System step inside the Data Flow Task, but I have to do it in the Control Flow tab.
My question is how do I do a simple thing like assign a value to a variable (I saw how to create variable and assign them a value at the bottom pane of Data Tools (2012)) depending of if the "step" succeeds or fails?
Thanks!
(You can tell by my question that I'm an SSIS rookie - and don't assume I can write a C# script, please)
I have used VB or C# scripts to accomplish this myself. Since you do not want to use scripts I would recommend using a different path for the project to flow. Have your success path lead to moving the file to completed and failure path lead to moving the file to failed. This keeps it simple and accomplishes what you are looking for.

Dynamic Configuration of Script Task in SSIS

I have to execute a VB script on some data from a CRM database in a data flow task. I want to make it configurable on other system as well.
I am able to assign the connection string of the connection manager dynamically by configuring through variable using a configuration file. Is there any way to configure the ScriptLink property of Script Component Editor so that I can make the address of the script dynamic.
I have also tried CozyRoc Script Task + also but am still confused. I will highly appreciate any help.

Execute XML Source after script component completes in ssis

I want to execute the XML source after a script component is complete n SSIS data flow. i.e based on whether the script fails or passes the xml source flow should start (in the data flow). Is there any simpler way to do it.
I cannot create a connector because XML source doesn't have any inputs.
Got it, i can add a script task instead of script component in dataflow. And make a flow from script task to data flow.