Script component source performance

Hi All
in one our requirement we need to load data from files from different 2 servers . the file structure is little complex . it will be in apart from 1st column all other column in key=value format and it contains different number of columns with different
types of rows . based on last cloumn Key type we need identify the type of the row and pass that row to that table.
the challanging part is we need to load these files for every 5 minutes and these files are cummulative . any how we achived all the requirements but the entire process is taking 2.45 secs  , in this only the script component is taking major time ,
how to fine tuning the script component source task ..
Please let me know how to tune script component task . is there any specific settings i need to fallow?
Surendra Thota

Here is the code
Public Overrides Sub CreateNewOutputRows()
Dim lineIndex As Integer = 0
Dim NumberOfColumns As Integer = 0
Dim ColumnIndex As Integer = 0
Dim ColumnSplitValuearray As String() = {"", ""}
While (Not sr.EndOfStream)
Dim line As String = sr.ReadLine()
Dim columnArray As String() = line.Split(Convert.ToChar(","))
NumberOfColumns = columnArray.Length
If columnArray(NumberOfColumns - 1).Split(Convert.ToChar("="))(0).ToString = "Average Latency" Then
OutputAverageLatencyBuffer.AddRow()
OutputAverageLatencyBuffer.Epoch = columnArray(0).Split(Convert.ToChar("="))(1)
For ColumnIndex = 2 To NumberOfColumns - 1
ColumnSplitValuearray(0) = columnArray(ColumnIndex).Split(Convert.ToChar("="))(0)
ColumnSplitValuearray(1) = columnArray(ColumnIndex).Split(Convert.ToChar("="))(1)
If (ColumnSplitValuearray(0).ToString = "Site") Then
OutputAverageLatencyBuffer.Site = ColumnSplitValuearray(1)
ElseIf (ColumnSplitValuearray(0).ToString = "Group") Then
OutputAverageLatencyBuffer.Group = ColumnSplitValuearray(1)
ElseIf (ColumnSplitValuearray(0).ToString = "Application") Then
OutputAverageLatencyBuffer.Application = ColumnSplitValuearray(1)
ElseIf (ColumnSplitValuearray(0).ToString = "Command") Then
OutputAverageLatencyBuffer.Command = ColumnSplitValuearray(1)
ElseIf (ColumnSplitValuearray(0).ToString = "Destination Realm") Then
OutputAverageLatencyBuffer.DestinationRealm = ColumnSplitValuearray(1)
ElseIf (ColumnSplitValuearray(0).ToString = "Egress Peer Origin Host") Then
OutputAverageLatencyBuffer.EgressPeerOriginHost = ColumnSplitValuearray(1)
ElseIf (ColumnSplitValuearray(0).ToString = "Egress Peer Origin Realm") Then
OutputAverageLatencyBuffer.EgressPeerOriginRealm = ColumnSplitValuearray(1)
ElseIf (ColumnSplitValuearray(0).ToString = "Ingress Peer Origin Host") Then
OutputAverageLatencyBuffer.IngressPeerOriginHost = ColumnSplitValuearray(1)
ElseIf (ColumnSplitValuearray(0).ToString = "Ingress Peer Origin Realm") Then
OutputAverageLatencyBuffer.IngressPeerOriginRealm = ColumnSplitValuearray(1)
ElseIf (ColumnSplitValuearray(0).ToString = "Origin Host") Then
OutputAverageLatencyBuffer.OriginHost = ColumnSplitValuearray(1)
ElseIf (ColumnSplitValuearray(0).ToString = "Origin Realm") Then
OutputAverageLatencyBuffer.OriginRealm = ColumnSplitValuearray(1)
ElseIf (ColumnSplitValuearray(0).ToString = "Outbound Message Processing") Then
OutputAverageLatencyBuffer.OutboundMessageProcessing = ColumnSplitValuearray(1)
ElseIf (ColumnSplitValuearray(0).ToString = "Response Processing") Then
OutputAverageLatencyBuffer.ResponseProcessing = ColumnSplitValuearray(1)
ElseIf (ColumnSplitValuearray(0).ToString = "Request Processing") Then
OutputAverageLatencyBuffer.ResponseProcessing = ColumnSplitValuearray(1)
ElseIf (ColumnSplitValuearray(0).ToString = "Result") Then
OutputAverageLatencyBuffer.Result = ColumnSplitValuearray(1)
ElseIf (ColumnSplitValuearray(0).ToString = "Role") Then
OutputAverageLatencyBuffer.Role = ColumnSplitValuearray(1)
ElseIf (ColumnSplitValuearray(0).ToString = "Average Latency") Then
OutputAverageLatencyBuffer.AverageLatency = ColumnSplitValuearray(1)
End If
Next
ElseIf (columnArray(NumberOfColumns - 1).Split(Convert.ToChar("="))(0).ToString = "Rate") Then
OutputRateCountBuffer.AddRow()
OutputRateCountBuffer.Epoch = columnArray(0).Split(Convert.ToChar("="))(1)
For ColumnIndex = 2 To NumberOfColumns - 1
ColumnSplitValuearray(0) = columnArray(ColumnIndex).Split(Convert.ToChar("="))(0)
ColumnSplitValuearray(1) = columnArray(ColumnIndex).Split(Convert.ToChar("="))(1)
If (ColumnSplitValuearray(0).ToString = "Site") Then
OutputRateCountBuffer.Site = ColumnSplitValuearray(1)
ElseIf (ColumnSplitValuearray(0).ToString = "Group") Then
OutputRateCountBuffer.Group = ColumnSplitValuearray(1)
ElseIf (ColumnSplitValuearray(0).ToString = "Application") Then
OutputRateCountBuffer.Application = ColumnSplitValuearray(1)
ElseIf (ColumnSplitValuearray(0).ToString = "Command") Then
OutputRateCountBuffer.Command = ColumnSplitValuearray(1)
ElseIf (ColumnSplitValuearray(0).ToString = "Destination Realm") Then
OutputRateCountBuffer.DestinationRealm = ColumnSplitValuearray(1)
ElseIf (ColumnSplitValuearray(0).ToString = "Egress Peer Origin Host") Then
OutputRateCountBuffer.EgressPeerOriginHost = ColumnSplitValuearray(1)
ElseIf (ColumnSplitValuearray(0).ToString = "Egress Peer Origin Realm") Then
OutputRateCountBuffer.EgressPeerOriginRealm = ColumnSplitValuearray(1)
ElseIf (ColumnSplitValuearray(0).ToString = "Ingress Peer Origin Host") Then
OutputRateCountBuffer.IngressPeerOriginHost = ColumnSplitValuearray(1)
ElseIf (ColumnSplitValuearray(0).ToString = "Ingress Peer Origin Realm") Then
OutputRateCountBuffer.IngressPeerOriginRealm = ColumnSplitValuearray(1)
ElseIf (ColumnSplitValuearray(0).ToString = "Origin Host") Then
OutputRateCountBuffer.OriginHost = ColumnSplitValuearray(1)
ElseIf (ColumnSplitValuearray(0).ToString = "Origin Realm") Then
OutputRateCountBuffer.OriginRealm = ColumnSplitValuearray(1)
ElseIf (ColumnSplitValuearray(0).ToString = "Result") Then
OutputRateCountBuffer.Result = ColumnSplitValuearray(1)
ElseIf (ColumnSplitValuearray(0).ToString = "Role") Then
OutputRateCountBuffer.Role = ColumnSplitValuearray(1)
ElseIf (ColumnSplitValuearray(0).ToString = "Count") Then
OutputRateCountBuffer.Count = ColumnSplitValuearray(1)
ElseIf (ColumnSplitValuearray(0).ToString = "Rate") Then
OutputRateCountBuffer.Rate = ColumnSplitValuearray(1)
End If
Next
End If
lineIndex = lineIndex + 1
End While
End Sub
End Class
Surendra Thota

Similar Messages

  • Error in SSIS Script Component

    Development environment : SQL Server Business Intelligence  Development Studio 2008
    I have developed SSIS package to insert/update records to production Database. In this case I'm using  a Script component to call a Stored Procedure to do the data access. I putted a User defined variable into
    ReadOnlyVariables container. When execute the package I got the following error.
    ERROR:
    Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.SqlServer.Dts.Runtime.Wrapper.IDTSVariables100'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{22992C1D-393D-48FB-9A9F-4E4C62441CCA}'
    failed due to the following error: The application called an interface that was marshalled for a different thread. (Exception from HRESULT: 0x8001010E (RPC_E_WRONG_THREAD)).
    at Microsoft.SqlServer.Dts.Runtime.Wrapper.IDTSVariables100.Unlock()
    at Microsoft.SqlServer.Dts.Pipeline.ScriptComponent.UnlockReadOnlyVariables()
    at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.PostExecute()
    Appreciate if any assistance regarding this!
    Kind Regards, 

    What is your readonly variable meant to store: a value to be supplied as argument to the stored procedure?
    Either way, I agree with SSISJoost, try to use Execute Sql Task, I prefer to make as much as possible use of the SSIS components.
    Maybe the reason why you write a script is that you assume one cannot call an EXEC stored procedure immediately in a data source in a data flow component. But you can prepare the Exec statment in a string variable and then use that string variabl in
    a Oled db source with SQL command as variable.
    Jan D'Hondt - SQL server BI development

  • Error while executing SSIS package which contains Script component through SQL Server Agent Job

    Hello All,
    I have written one SSIS 2012 package which is fetching records from CSV and put it into staging DB and from staging DB , using SSIS script component task, I am inserting data into Dynamics CRM. So far it is working fine when
    I manually execute SSIS package.
    but when I run the SSIS package using SQL server agent job, I encounter below error. After seeing below error at step "Insert TLM Headers Script Component " I understand that it is failing at script component which I have used in SSIS package,
    but I am not sure what is the cause behind that? please advise.
    Error:
    Executed as user: domain\user account. Microsoft (R) SQL Server Execute Package Utility  Version 11.0.5556.0 for 64-bit  Copyright (C) Microsoft Corporation. All rights reserved.    Started:  1:21:41 PM  Error: 2015-02-25
    13:21:45.94     Code: 0xC0047062     Source: Insert TLM Headers Script Component [205]     Description: System.ServiceModel.FaultException: The server was unable to process the request due to an internal
    error.  For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the <serviceDebug> configuration behavior) on the server in order to send the exception information back to
    the client, or turn on tracing as per the Microsoft .NET Framework 3.0 SDK documentation and inspect the server trace logs.    Server stack trace:      at System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(Message
    reply, MessageFault fault, String action, MessageVersion version, FaultConverter faultConverter)     at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)    
    at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)     at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage
    methodCall, ProxyOperationRuntime operation)     at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)    Exception rethrown at [0]:      at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.HandleUserException(Exception
    e)     at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.ProcessInput(Int32 inputID, PipelineBuffer buffer)     at Microsoft.SqlServer.Dts.Pipeline.ManagedComponentHost.HostProcessInput(IDTSManagedComponentWrapper100
    wrapper, Int32 inputID, IDTSBuffer100 pDTSBuffer, IntPtr bufferWirePacket)  End Error  Error: 2015-02-25 13:21:45.94     Code: 0xC0047022     Source: Insert TLM Headers SSIS.Pipeline    
    Description: SSIS Error Code DTS_E_PROCESSINPUTFAILED.  The ProcessInput method on component "Script Component" (205) failed with error code 0x80131501 while processing input "Input 0" (215). The identified component returned an error
    from the ProcessInput method. The error is specific to the component, but the error is fatal and will cause the Data Flow task to stop running.  There may be error messages posted before this with more information about the failure.  End Error 
    DTExec: The package execution returned DTSER_FAILURE (1).  Started:  1:21:41 PM  Finished: 1:21:45 PM  Elapsed:  4.009 seconds.  The package execution failed.  The step failed.
    Thanks
    Pankaj

    domain\user account has not proper rights
    That being said, often SSIS jobs require a proxy to be runnable and this is how you make one up
    http://www.mssqltips.com/sqlservertip/2163/running-a-ssis-package-from-sql-server-agent-using-a-proxy-account/
    Arthur
    MyBlog
    Twitter

  • Assigning value to a variable in Script Component.

    I'm pretty new to SSIS development and need to figure out a problem with assigning a value to a user defined variable. I created a pretty simple package. It reads a flat file, extracts date from a header record and subsequently uses derived column component
    to reformat data to the desired output format. One of the columns (FileRunDate,
    string, length 8) in the derived component is defined as a string and in the expression I'm assigning it to a variable I set earlier in the script component -
    @[User::vRunTimeDate]. When the process runs, the output file gets generated, however FileRunDate reflects
    originally set varible's value. It seems that the variable assignment in the script task does not work, even though in the debug mode, I do see how the value is being set. The variable has an attribute of ReadWrite. Is it due to the fact that the value is
    being set in the same workflow?
    Any feedback is greatly appriciated.

    Unfortunately I'm unable to add a screenshot of the process, for some reason I get an error message when I try to do that. In a nutshell the entire workflow consist of flat file source component, following by a script component (this is where I read and
    assign the variable) 
        public override void PostExecute()
            IDTSVariables100 vars;
            base.PostExecute();
            // Set run date
            if (strRunDate != null)
                VariableDispenser variableDispenser = (VariableDispenser)this.VariableDispenser;
                variableDispenser.LockForWrite("User::vRunTimeDate");
                variableDispenser.GetVariables(out vars);
                // Set the variable
                vars["User::vRunTimeDate"].Value = strRunDate;
                //Unlock the variable 
                vars.Unlock();
                //Variables.vRunTimeDate = strRunDate;
    then goes conditional split ( filtering out unwanted records), which is connected to a derived column component (this is where one of the columns get assigned a variable's value), one more script component (this where I identify
    specific data element and do a replace command) and finally flat file destination.
    BTW, the article in the provided URL clearly states that variable won't reflect assigned value till the entire workflow has finished. If that's the case, then I think I know my
    answer. Is there is such a thing as putting execution of different steps in a different step, so anything executed subsequently will see that value?

  • SSIS script component to use defined connection manager to load data from a Oracle

    In SSIS script compoment, I can connect to oracle with hard-coded connectionstring:
    OracleConnection conn;
    conn = new OracleConnection();
    conn.ConnectionString = "Data Source=XE;User ID=hr;Password=******";
    however, when I defined an connection managers in the script compoment and call it as follows:
        IDTSConnectionManager100 connMgr;
        OracleConnection conn;
        public override void AcquireConnections(object Transaction)
            connMgr = this.Connections.MyADONETConnectionManager;
            conn = (OracleConnection)connMgr.AcquireConnection(null);
    I got error below:
    TITLE: Package Validation Error
    Package Validation Error
    ADDITIONAL INFORMATION:
    Error at Data Flow Task source [Script Component C# Oracel HR Oracle [21]]: System.InvalidCastException: Unable to cast COM object of type 'System.__ComObject' to class type 'Oracle.DataAccess.Client.OracleConnection'. Instances of types that represent COM
    components cannot be cast to types that do not represent COM components; however they can be cast to interfaces as long as the underlying COM component supports QueryInterface calls for the IID of the interface.
       at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.HandleUserException(Exception e)
       at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.AcquireConnections(Object transaction)
       at Microsoft.SqlServer.Dts.Pipeline.ManagedComponentHost.HostAcquireConnections(IDTSManagedComponentWrapper100 wrapper, Object transaction)
    Error at Data Flow Task source [SSIS.Pipeline]: Script Component C# Oracel HR Oracle failed validation and returned error code 0x80004002.
    Error at Data Flow Task source [SSIS.Pipeline]: One or more component failed validation.
    Error at Data Flow Task source: There were errors during task validation.
     (Microsoft.DataTransformationServices.VsIntegration)
    I did not find any example for Orale. A similar SQL server example is as linked below:
    http://technet.microsoft.com/en-us/library/ms135939(v=sql.110).aspx
    can anybody shed some light? I appreciate it...
    thanks,
    Steve

    You need to create a connectionmanager for Oracle connection and use it within the script task
    See
    http://www.mssqltips.com/sqlservertip/1787/oracle-parameterized-queries-in-sql-integration-services-ssis/
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • How to fix DT_Text and DT_NText Read Only in Script Component

    I have a script component that I have written and works as long as the Output columns on the script are string types.  When I change the output column type to text (since the size could be essentially unlimited) it gives an error in the script component that the property is read only.
    Here is the code line that fails with Property Payments is read only.
    Output0Buffer.Payments = fieldValues(i)
    If I change the column payments to DT_Wstr it works without issue, but I want to use text incase the value is large.
    Here is the error if you try to run the actual script even though I know it has an error.
    TITLE: Package Validation Error
    Package Validation Error
    ADDITIONAL INFORMATION:
    Error at Data Flow Task [Script Component [85]]: Error 30526: Property 'Payments' is 'ReadOnly'.
    Line 86   Column 13 through 69
    Error 30526: Property 'Ops' is 'ReadOnly'.
    Line 155   Column 13 through 65
    Error at Data Flow Task [Script Component [85]]: Error 30526: Property 'Payments' is 'ReadOnly'.
    Line 86   Column 13 through 69
    Error 30526: Property 'Ops' is 'ReadOnly'.
    Line 155   Column 13 through 65
    Error at Data Flow Task [DTS.Pipeline]: "component "Script Component" (85)" failed validation and returned validation status "VS_ISBROKEN".
    Error at Data Flow Task [DTS.Pipeline]: One or more component failed validation.
    Error at Data Flow Task: There were errors during task validation.
     (Microsoft.DataTransformationServices.VsIntegration)
    BUTTONS:
    OK

    Hi Jaegd,
    Im stuck at converting ntext datatype source column to varchar(max) target  using C# in SSIS ScriptComponent . Im new to C# and trying different processes but no luck . Can you give me some direction ? 
    using System;
    using System.Text;
    using System.Data;
    using Microsoft.SqlServer.Dts.Pipeline.Wrapper;
    using Microsoft.SqlServer.Dts.Runtime.Wrapper;
        public override void Input0_ProcessInputRow(Input0Buffer Row)
            System.Text.UnicodeEncoding encoding = new System.Text.UnicodeEncoding();
            Row.Body.AddBlobData(encoding.GetBytes("MyString"));
            byte[] bytes = Row.Body.GetBlobData(0, (int)Row.Body.Length);
            string myString = encoding.GetString(bytes);
    Im not sure if this even works as the output datatype is still ntext  and how can i add your suggestion   Output0Buffer.Payments.AddBlobData(Encoding.Unicode.GetBytes(SomeStringHere))
    . Im not sure what im missing . 

  • Update and Write Back DataTable in Object Variable Using Script Component

    Hi All..
    I'm trying to update an Object Type Variable [ReadWrite] with a Data Flow Task Script Component. Variable is already holding a record set with Column(s) like, ID, Name, IsProcessed.
    Now in my Data Flow Script Component, I'm trying to 1st) Fill a DataTable with my variables value then 2nd) Loop through each Input Rows in Data Flow Component and accordingly if there is a match of ID then updating IsProcessed Column in DataTable. 3rd &Finally,
    Copy datatable back to Object Type Variable.
    Below is the code used and just for your ref. I tried Printing content of whole DataTable after Update. This looks perfect but not sure why my variable is able to capture it.
    using System;
    using System.Data;
    using System.Data.OleDb;
    using Microsoft.SqlServer.Dts.Pipeline.Wrapper;
    using Microsoft.SqlServer.Dts.Runtime.Wrapper;
    using System.Windows.Forms;
    using System.Collections.Generic;
    using System.Text;
    [Microsoft.SqlServer.Dts.Pipeline.SSISScriptComponentEntryPointAttribute]
    public class ScriptMain : UserComponent
    DataTable dt = new DataTable();
    OleDbDataAdapter adapter = new OleDbDataAdapter();
    List<string> listriuid = new List<string>();
    public override void PreExecute()
    base.PreExecute();
    public override void PostExecute()
    base.PostExecute();
    adapter.Fill(dt, this.Variables.varobjChildPackageLog);
    dt.AcceptChanges();
    foreach (DataRow row in dt.Rows)
    if (listriuid.Contains(row["ID"].ToString()))
    row["IsProcessed"] = "Y";
    // Just to see the Final Data Table Output
    //StringBuilder b = new StringBuilder();
    //foreach (System.Data.DataRow r in dt.Rows)
    // foreach (DataColumn c in dt.Columns)
    // b.Append(c.ColumnName.ToString() + ":" + r[c.ColumnName].ToString());
    //MessageBox.Show(b.ToString());
    this.Variables.varobjChildPackageLog = dt;
    dt.Dispose();
    adapter.Dispose();
    public override void RIUIDInput_ProcessInputRow(RIUIDInputBuffer Row)
    try
    listriuid.Add(Row.ID.ToString());
    catch (Exception ex)
    MessageBox.Show(ex.Message.ToString());
    Regards, Avik M.

    why do you need to do this in script task.
    This is just a matter of using lookup task while you retrive data from source itself to find the matches and use a derived column transform to check and set appropriate value for IsProcessed column. The object variable itself is not required and you dont
    even require a looping statement either!
    If both source and lookup tables are in same server then you can just wrap them inside source sql query itself to do matching and retrieve the value for IsProcessed within select statement itself in OLEDB Source inside data flow.
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Major Bug in SSIS 2012 Script Component - Potentially

    I think there is a major issue with the Script Component in SSIS when running SSDT on Windows 8.1. I have a Script Component that functions as a data source. The script compiles successfully. However, when returning back to the Data Flow Task, I still get the
    following error which I'd get when an error exists in the Script.
    Validation error. Data Flow Task Script Component [2]: The binary code for the script is not found. Please open the script in the designer by clicking Edit Script button and make sure it builds successfully.
    The script compiles successfully so this is frustrating. This is incorrect and I believe it's an issue with SSDT/SSIS when run on Windows 8.1. I've applied SQL Server 2012 SP1 with CU7 and the error still exists. Can someone else confirm this as
    a bug? 
    &lt;a href=&quot;http://martinsbiblog.spaces.live.com&quot; target=&quot;_blank&quot;&gt;http://martinmason.wordpress.com&lt;/a&gt;

    I'm simply doing the following: 
    Add a Data Flow Task.
    Add a Script Component. Configure as a Source.
    Double click on the Script Component.
    Click on the Edit Script button.
    Compile the script. Compiles successfully.
    Close the VSTAProject editor.
    Close the Script Component properties page.
    When returning to the Data Flow, the "Binary code for the script is not found" error is return
    Running as an Administrator did not solve the problem. Again, this is only an issue with SSIS on Windows 8.1 so if you're not running on Windows 8.1, do not bother replying. I've applied SP1 and CU7 and the problem was not resolved.
    Really regretting upgrading to Windows 8.1.
    &lt;a href=&quot;http://martinsbiblog.spaces.live.com&quot; target=&quot;_blank&quot;&gt;http://martinmason.wordpress.com&lt;/a&gt;

  • Data conversion into specified format using Script component in SSIS 2008

    We have a field in the flat file source which is of the format 13399I , and it need to be type cast to the below format.
     13399I = 1339.99
     5950{ = 595.00
    The sign field equals:
    {=0
    A=1
    B=2
    C=3
    D=4
    E=5
    F=6
    G=7
    H=8
    I=9
    please let us know how to accomplish using script component in SSIS

    You can use the following in the script task.
    1) Create a dictionary to hold the key-value pairs ({=0,A=1...).
    2) Use a substring function to pull out all the string minus the last character.
    3) Append the last character back after replacing the character with the respective value from the dictionary.
    4) Convert the final string to int/decimal/numeric as per the destination.
    Do keep in mind, the data you are referring to is in the COMP3 format. You can do some further research regarding how to convert COMP3 to decimal. There are many ways out there. I personally prefer to load the data into a table and us a lookup table
    to do all this. But it's entirely by preference.

  • Programmatically creating Transformation Script Component

    Does anyone have any examples of programmatically creating a Transformation Script Component (or Source/Destination) in the dataflow?  I have been able to create other Transforms for the dataflow like Derived Column, Sort, etc. but for some reason the Script Component doesn't seem to work the same way.
    I have done it as below trying many ways to get the componentClassId including the AssemblyQualifiedname & the GUID as well.  No matter, what I do, when it hits the ProvideComponentProperties, it get Exception from HRESULT: 0xC0048021
    IDTSComponentMetaData90 scriptPropType = dataFlow.ComponentMetaDataCollection.New();
    scriptPropType.Name = "Transform Property Type";
    scriptPropType.ComponentClassID = "DTSTransform.ScriptComponent";
    // have also tried scriptPropType.ComponentClassID =typeof(Microsoft.SqlServer.Dts.Pipeline.ScriptComponent).AssemblyQualifiedName;
    scriptPropType.Description = "Transform Property Type";
    CManagedComponentWrapper instance2 = scriptPropType.Instantiate();
    instance2.ProvideComponentProperties();
    Any help or examples would be greatly appreciated!  Thanks!

    I am working on the creating script component programmatically.
    The code has been created is shown in the following,
    Dim SourceCodeValue(3) As String
    Dim scriptPropType As PipeLineWrapper.IDTSComponentMetaData90 = _
    CType(CType(dataflowTask, TaskHost).InnerObject, PipeLineWrapper.MainPipe).ComponentMetaDataCollection.New()
    scriptPropType.Name = "Transform Property Type"
    scriptPropType.ComponentClassID = "{BF01D463-7089-41EE-8F05-0A6DC17CE633}"
    scriptPropType.Description = "Transform Property Type"
    Dim instance2 As PipeLineWrapper.CManagedComponentWrapper = scriptPropType.Instantiate()
    instance2.ProvideComponentProperties()
    SourceCodeValue(0) = "dts://Scripts/" & "ScriptComponent_9ddf9eba6f5b488f9710b95e4d7e7c74" & _
    "/" & "ScriptComponent_9ddf9eba6f5b488f9710b95e4d7e7c74" & ".vsaproj"
    SourceCodeValue(1) = My.Resources.ScriptComponentProjFile
    SourceCodeValue(2) = "dts://Scripts/" & "ScriptComponent_9ddf9eba6f5b488f9710b95e4d7e7c74" & _
    "/ScriptMain.vsaitem"
    SourceCodeValue(3) = My.Resources.ScriptComponentCode
    Dim anIDTSDesigntimeComponent90 As Microsoft.SqlServer.Dts.Pipeline.Wrapper.IDTSDesigntimeComponent90 = _
    CType(instance2, Microsoft.SqlServer.Dts.Pipeline.Wrapper.IDTSDesigntimeComponent90)
    anIDTSDesigntimeComponent90.SetComponentProperty("SourceCode", SourceCodeValue)
    anIDTSDesigntimeComponent90.SetComponentProperty("PreCompile", False)
    When debugger reach to “anIDTSDesigntimeComponent90.SetComponentProperty("SourceCode", scriptValue)”, NullReferenceException. “Use the “New” keyword to create an object instance” was shown.
    Could you please give me some help or suggestion?
    Thank you so much in the advance

  • Need help solving script component failure (SSIS Visual Studio tools 2.0 using VB 2008)

    Hello,
    I am new to SSIS but believe I have fought my way through this one where I almost have it.
    I copied am existing successful package that uses a loop (and VB code) for ETL of a file. The difference is that I have a new Excel file with different content (I carefully modified the VB code to match the current file). When I run the package I am down
    to just a couple of errors now under the “progress  tab”. I am hoping you can point me in the correct direction to resolve this.
    First I get a Script Component Runtime Error as I run (debug) this package:
    at Microsoft.SqlServer.Dts.Pipeline.ScriptComponent.get_ReadWriteVariables()
    at SC_712a9d2c4d4a4a48a2c07c5f14c80b1a.vbproj.Variables.get_sFacility()
    at SC_712a9d2c4d4a4a48a2c07c5f14c80b1a.vbproj.ScriptMain.Input0_ProcessInputRow(Input0Buffer Row)
    at SC_712a9d2c4d4a4a48a2c07c5f14c80b1a.vbproj.UserComponent.Input0_ProcessInput(Input0Buffer Buffer)
    at SC_712a9d2c4d4a4a48a2c07c5f14c80b1a.vbproj.UserComponent.ProcessInput(Int32 InputID, PipelineBuffer Buffer)
    at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.ProcessInput(Int32 inputID, PipelineBuffer buffer)
    The Data Flow “Progress tab reveals 2 messages
    [Create ED1_2 Feeder File [1760]] Error: Microsoft.SqlServer.Dts.Pipeline.ReadWriteVariablesNotAvailableException: The collection of variables locked for read and write access is not available outside of PostExecute.
       at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.HandleUserException(Exception e)
       at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.ProcessInput(Int32 inputID, PipelineBuffer buffer)
       at Microsoft.SqlServer.Dts.Pipeline.ManagedComponentHost.HostProcessInput(IDTSManagedComponentWrapper100 wrapper, Int32 inputID, IDTSBuffer100 pDTSBuffer, IntPtr bufferWirePacket)
    AND #2:
    [SSIS.Pipeline] Error: SSIS Error Code DTS_E_PROCESSINPUTFAILED. 
    The ProcessInput method on component "Create ED1_2 Feeder File" (1760) failed with error code 0x80131600 while processing input "Input 0" (1762). The identified component returned an error from the ProcessInput method. The error is
    specific to the component, but the error is fatal and will cause the Data Flow task to stop running. 
    There may be error messages posted before this with more information about the failure.
    Any suggestions?  I know the code I copied from the source package works perfectly there, but my copy (and then modified) version of the VB code fails in my new package.
    THANKS!!!!!

    Thank You. While waiting for a response I decided that instead of copying the package and editing according to my new source file, that I should rebuild it from scratch
    manually instead (while using the original as a model). Well... it worked!
    (probably could have repaired the other too with your help and with additional effort, etc.). You were right to suspect the variables as I found properties didn't match there as far as scope. In fact that was the last thing I was working
    on when it finally worked.  So, as the late Gilda Radner used to say..."never mind". Thanks again.

  • How to assign money value to CRM money field in Script component?

    Hi All,
    Can anyone please help me with below issue?
    I have a money value (eg. 25.00) in the SQL table (Source) of type string which I am reading it in script component and want to push that same to MS CRM(destination) currency field.
    I have used Money class but still it is throwing the exception "System.InvalidCastException: Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #444AFC47"
    Used this lines of code. Please let me know if I am doing anything wrong and help with resolution.
                    if (!Row.Amount_IsNull)
                        Money Amount = new Money();
                        Amount.Value = Convert.ToDecimal(Row.Amount);
                        newTbldetails["new_amount"] = Amount.Value;
    Note: new_amount is the attribute in MS CRM (destination) with type Currency.
    Thanks,
    Sri

    This below code worked. There was a mistake in the assignment.
                    if (!Row.Amount_IsNull)
                        Money Amount = new Money();
                        Amount.Value = Convert.ToDecimal(Row.Amount);
                        newTbldetails["new_amount"] =
    Amount;
    Thanks,
    Sri

  • Script Component - variables locked for read and write not available outside of post execute

    Hello,
    I have two Data flow task,
    Frist one has OLE DB Source and Script Component as Transformation
    I have package level variable called AllSiteIds
    In first DFT, i have a local varibale that is declared before PreExecute method and after ScriptMain:UserComponent line.
    This local variable is used in Input process method to concatenate the one of the row values like below
    SiteId = SiteId + Row.SID.ToString()+",";
    The package level variable AllSiteIds is set for ReadWrite on script component.
    In my post execute i am setting package level variable AllSiteIds
    Variables.AllSiteIds = SiteId;
    In my second DFT, i have OLEDB source and Script transformation and i am accessing the package level variable AllSiteIds in Preexcute but not able to do so and getting error mentioned in subject.
    My goal is to create string of all SiteIds delimited by comma and have it available in second DFT to be used in Preexcute.
    The sql command i am using to get all unique siteid's is
    Select SiteId from dbo.Services
    Group By SiteId
    Order By SiteId
    Using the result from above i need to create comma delimited string of all site ids' and store it in variable so i can use it in pre excute of second DFT.
    Please suggest on how to accomplish above?

    If all you want is to generate a string of ids then you can simply use a Execute sql task for this and use a query based on FOR XML PATH which will generate the string of ids
    http://visakhm.blogspot.in/2014/01/rowset-concatenation-with-special.html
    then inside execute sql task set resultset option as single row and store the result ina SSIS varaiable of type string.
    Once this is done you can then use this variable inside the subsequent data flow task 
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • [ER] Introduce af:script component

    Hi!
    Trinidad includes tr:script component. ADF RC is lacking one (and I don't like mixing tr: and af: as it produces strange issues). Lot of blog posts by Frank and others is still using plain-text snippets like
    <f:facet name="metaContainer">    
    <af:group>      
    <![CDATA[          
    <script>
    function clientMethodCall(event) {
                     </script>
    ]]>    
    </af:group>   
    </f:facet>I would like to suggest introducing advanced af:script component that allows:
    1.     declarative .js file inclusion (src="..." attribute) with relative and absolute path referencing (this is very important for cases when the script is used in templates, custom components and other reusable components where it is not predictable in which page/url the script rendering will occur in run-time)
    2.     declarative script text inclusion and script source code editing (with code coloring and auto-completion support for easy coding with particular support to ADF RC Client Script API)
    3.     script inclusion control logic like:
    a.     singularInclusion="true/false" attribute that ensures that script is included in run-time generated JSP only once per page (to prevent cases when I have same script included multiple times on page as it is appearing in several reusable components – custom components, jsffs in multiple regions etc.). This attrib should check if the script with same id (possibly uniquely identified by special scriptId or scripKey attribute) is already included in view/page and prevent multiple inclusions. In some cases the multiple inclusions are desired (like with in-line non-differed scripts).
    b.     rendered="true/false"
    c.     deffered="true/false"
    4.     support for script debugging
    Also, I would suggest that ADF RC both client-side and server-side api include enhanced support for registering/including client scripts (with above mentioned support for checking if script with particular scriptId is already registered/included, de-registering particular scriptId etc.).
    I remember that .Net have a much better support for client-script handling so I would encourage ADF devs to consider this.
    Kind regards,
    PaKo

    Hello Pavle,
    It's true that some of those features are nice. You might want to look at the Scriplet API as it more or less does what you want. It's a quite complex and complicated API, but it support pretty much all the of the features you're asking for.
    Also, as a side note, I suggest that you take a look at JSF 2.0 early draft (http://jcp.org/aboutJava/communityprocess/edr/jsr314/index.html), and more specifically at the resource section to see if it's better suited for your needs. Of course, you won't have those in JDeveloper 11g, but it'll be a head up for what's to come.
    Regards,
    ~ Simon

  • How can i edit script component in another machine?

    Hello everyone,
    i am using sqlserver data tools to build a package..
    i have alot of script components...the problem is i wrote this package in machine A ... when i take the whole solution in machine B 
    i can not edit or see the script components projects files etc...
    am i missing an atribute at package solution/project file?
    because in ssis 2008 r2 version i can edit all of components (script componet,oledb source component...etc.)
    ...but  in 2012 version of ssis i can not edit script component project..
    thanks a lot..
    evgeni

    Evgeni
    because in ssis 2008 r2 version i can edit all of components (script componet,oledb source component...etc.)
    ...but  in 2012 version of ssis i can not edit script component project"
    I guess you need to upgrade the package/solution 1st to the SSIS 2012 format.
    You need to go to Start-Microsoft SQL Server 2012->Integration Services and choose
    Project Conversion Wizard .
    Once the project (not just a package) is converted to SSIS 2012 open it in SSDT, access your Script Component and then choose
    Design Script button
    Arthur My Blog

Maybe you are looking for