Script Component in Dataflow
Hi Friends, I am stuck in a problem where in the old DTS package dts transformation consists of active x script for some of the columns.. I have rewritten most of them using derived column, But some of the trnasformation would require me to use the script
component in the dataflow task.. I want to now how can I access the columns values in the script component(in Dataflow task) , massage the value and reassign value to it according to the business logic..?
I will be using C# in the script component task.
Any help is greatly Appreciated!!
Thanks,
GopuGopal
May 10th, 2011 12:30pm
Hello,
Here are some links that you can look and start building your code
http://www.mathgv.com/sql2005docs/SSISTransformScriptETL.htm
http://www.sqlis.com/sqlis/post/The-Script-Component-as-a-Transformation.aspx
Thankshttp://sqlage.blogspot.com/
Free Windows Admin Tool Kit Click here and download it now
May 10th, 2011 12:56pm
you can refer this below link for adding script task as data source.
http://www.ssistalk.com/2007/04/04/ssis-using-a-script-component-as-a-source/
May be you can use the same logic to add new columns
May 10th, 2011 1:04pm
Both of you have given links where I can get the columns into the script task.. But I want to massage the column data and reassign a value to it according to business logic using C#.. Can anyone please show me how to do that?
Thanks,
GopuGopal
Free Windows Admin Tool Kit Click here and download it now
May 10th, 2011 4:06pm
This can easily be done using the Script Transformation in DFT.
BI Monkey has a good high-level into to it which includes its basic usage: http://www.bimonkey.com/2009/09/the-script-transformation-part-1-a-simple-transformation/Arthur My Blog
May 10th, 2011 4:13pm
Thnx For that ArthurZ, But when I try to access my out put column in the script task I get an error
public
override
void Input0_ProcessInputRow(Input0Buffer
Row)
{
if (Row.Column11 ==
"")
//Row.Column11 is input column
Row.Col11 =
null;
//Row.Col11 is output column
else
Row.Col11 = (
decimal
)Row.Column11;
}
ERROR
is
Error 1 'Input0Buffer' does not contain a definition for 'Col11' and no extension method
'Col11' accepting a first argument of type 'Input0Buffer' could be found (are you missing a using directive or an assembly reference?) C:\Documents and Settings\axgopalp\Local Settings\Temp\SSIS\d2d6dbdda7cb4b7a91ed177f32049563\main.cs 35 17 sc_e52dc55b187540c0bc5e87cc054ed662
Gopal
Free Windows Admin Tool Kit Click here and download it now
May 10th, 2011 5:20pm
You need to make sure that you have selected "Col11" as a ReadWrite column in the Script Editor (not the code editor) on the Input Columns section.
Once you've done that, you should see intellisense for that column.
You also can not assign a column a null value explicitly. Instead, you need to assign the row property "Col1_IsNull" a true value.
Talk to me now on
May 10th, 2011 5:41pm
Now I dont know how to do that also..!! :(
Im new to this..!!
Gopal
Free Windows Admin Tool Kit Click here and download it now
May 10th, 2011 6:04pm
Try this
Open the Script Transformation Editor and select Input Columns (Left hand side of editor).
Set Column11 as the input column and Col11 as the Output Alias.
Set usage type to ReadWrite.
Jeff Wharton MSysDev (C.Sturt), MDbDsgnMgt (C.Sturt)
May 10th, 2011 7:58pm
If I do as you said I think it is jus aliases the input columns... I tried it..and intellisense doent give column11 and column19 anymore now.. instead it jus gives me col11 and col19.. Im totally dumb and lost now!! :(Gopal
Free Windows Admin Tool Kit Click here and download it now
May 11th, 2011 11:57am
Yupp Todd.. I got it this time.. .. What I had done to get this thing working was to build the solution after adding input and output columns.. Then I was able to access all of them
Thanks to all of the members who have posted to my query!!
GopuGopal
May 11th, 2011 12:42pm