Bulk Insert using Script Task in SSIS

Hi guys,
Please I have about 300Million rows of data I want to load from a remote SQL server into another SQL server. The problem is that the data takes forever to load and I have a time line.
I was wondering if there is a way in can do bulk insert for this or maybe if I can get a code that I can use to load the data faster.
Please I really need your help as my job depends on this.
me

CREATE TABLE [dbo].[post_tran](
[post_tran_id] [bigint] NOT NULL,
[post_tran_cust_id] [bigint] NOT NULL,
[settle_entity_id] [dbo].[POST_ID] NULL,
[batch_nr] [int] NULL,
[prev_post_tran_id] [bigint] NULL,
[next_post_tran_id] [bigint] NULL DEFAULT ((0)),
[sink_node_name] [dbo].[POST_NAME] NULL,
[tran_postilion_originated] [dbo].[POST_BOOL] NOT NULL,
[tran_completed] [dbo].[POST_BOOL] NOT NULL,
[message_type] [char](4) NOT NULL,
[tran_type] [char](2) NULL,
[tran_nr] [bigint] NOT NULL,
[system_trace_audit_nr] [char](6) NULL,
[rsp_code_req] [char](2) NULL,
[rsp_code_rsp] [char](2) NULL,
[abort_rsp_code] [char](2) NULL,
[auth_id_rsp] [varchar](10) NULL,
[auth_type] [numeric](1, 0) NULL,
[auth_reason] [numeric](1, 0) NULL,
[retention_data] [varchar](999) NULL,
[acquiring_inst_id_code] [varchar](11) NULL,
[message_reason_code] [char](4) NULL,
[sponsor_bank] [char](8) NULL,
[retrieval_reference_nr] [char](12) NULL,
[datetime_tran_gmt] [datetime] NULL,
[datetime_tran_local] [datetime] NOT NULL,
[datetime_req] [datetime] NOT NULL,
[datetime_rsp] [datetime] NULL,
[realtime_business_date] [datetime] NOT NULL,
[recon_business_date] [datetime] NOT NULL,
[from_account_type] [char](2) NULL,
[to_account_type] [char](2) NULL,
[from_account_id] [varchar](28) NULL,
[to_account_id] [varchar](28) NULL,
[tran_amount_req] [dbo].[POST_MONEY] NULL,
[tran_amount_rsp] [dbo].[POST_MONEY] NULL,
[settle_amount_impact] [dbo].[POST_MONEY] NULL,
[tran_cash_req] [dbo].[POST_MONEY] NULL,
[tran_cash_rsp] [dbo].[POST_MONEY] NULL,
[tran_currency_code] [dbo].[POST_CURRENCY] NULL,
[tran_tran_fee_req] [dbo].[POST_MONEY] NULL,
[tran_tran_fee_rsp] [dbo].[POST_MONEY] NULL,
[tran_tran_fee_currency_code] [dbo].[POST_CURRENCY] NULL,
[tran_proc_fee_req] [dbo].[POST_MONEY] NULL,
[tran_proc_fee_rsp] [dbo].[POST_MONEY] NULL,
[tran_proc_fee_currency_code] [dbo].[POST_CURRENCY] NULL,
[settle_amount_req] [dbo].[POST_MONEY] NULL,
[settle_amount_rsp] [dbo].[POST_MONEY] NULL,
[settle_cash_req] [dbo].[POST_MONEY] NULL,
[settle_cash_rsp] [dbo].[POST_MONEY] NULL,
[settle_tran_fee_req] [dbo].[POST_MONEY] NULL,
[settle_tran_fee_rsp] [dbo].[POST_MONEY] NULL,
[settle_proc_fee_req] [dbo].[POST_MONEY] NULL,
[settle_proc_fee_rsp] [dbo].[POST_MONEY] NULL,
[settle_currency_code] [dbo].[POST_CURRENCY] NULL,
[icc_data_req] [text] NULL,
[icc_data_rsp] [text] NULL,
[pos_entry_mode] [char](3) NULL,
[pos_condition_code] [char](2) NULL,
[additional_rsp_data] [varchar](25) NULL,
[structured_data_req] [text] NULL,
[structured_data_rsp] [text] NULL,
[tran_reversed] [char](1) NULL DEFAULT ((0)),
[prev_tran_approved] [dbo].[POST_BOOL] NULL,
[issuer_network_id] [varchar](11) NULL,
[acquirer_network_id] [varchar](11) NULL,
[extended_tran_type] [char](4) NULL,
[ucaf_data] [varchar](33) NULL,
[from_account_type_qualifier] [char](1) NULL,
[to_account_type_qualifier] [char](1) NULL,
[bank_details] [varchar](31) NULL,
[payee] [char](25) NULL,
[card_verification_result] [char](1) NULL,
[online_system_id] [int] NULL,
[participant_id] [int] NULL,
[opp_participant_id] [int] NULL,
[receiving_inst_id_code] [varchar](11) NULL,
[routing_type] [int] NULL,
[pt_pos_operating_environment] [char](1) NULL,
[pt_pos_card_input_mode] [char](1) NULL,
[pt_pos_cardholder_auth_method] [char](1) NULL,
[pt_pos_pin_capture_ability] [char](1) NULL,
[pt_pos_terminal_operator] [char](1) NULL,
[source_node_key] [varchar](32) NULL,
[proc_online_system_id] [int] NULL,
[from_account_id_cs] [int] NULL,
[to_account_id_cs] [int] NULL,
[pos_geographic_data] [char](5) NULL,
[payer_account_id] [char](5) NULL,
[cvv_available_at_auth] [varchar](30) NULL,
[cvv2_available_at_auth] [varchar](30) NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
me

Similar Messages

  • Getting error message when i am trying to update the excel file using script task in ssis package

    Hi Guys,
    I am getting error message when I am trying to update the excel. Please find the error messages as below
    Error at Update File [Update File]: Failed to compiled scripts contained in the package. Open the package in SSIS Designer and resolve the compilation errors.
    Error at Update File [Update File]: BC30002 - Type 'Microsoft.Office.Interop.Excel.Application' is not defined., ScriptMain.vb, 32, 32
    Error at Update File [Update File]: BC30002 - Type 'Microsoft.Office.Interop.Excel.Workbook' is not defined., ScriptMain.vb, 33, 25
    Error at Update File [Update File]: 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.
    Warning at Update File [Update File]: Found SQL Server Integration Services 2008 Script Task "ST_050fcae972904039b4f0fe59b7528ece" that requires migration!
    and the code that   I am using is
    Dell - Internal Use - Confidential
    ' Microsoft SQL Server Integration Services Script Task
    ' Write scripts using Microsoft Visual Basic
    ' The ScriptMain class is the entry point of the Script Task.
    Imports System
    Imports System.Data
    Imports System.Math
    Imports Microsoft.SqlServer.Dts.Runtime
    Imports Microsoft.Office.Interop.Excel
    <System.AddIn.AddIn("ScriptMain", Version:="1.0", Publisher:="",
    Description:="")> _
    <System.CLSCompliantAttribute(False)> _
    Partial
    Public Class ScriptMain
    Inherits Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase
    Enum ScriptResults
                Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success
    Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure
    End Enum
    Public Sub Main()
            Dts.TaskResult = ScriptResults.Success
    'Dim proc As System.Diagnostics.Process
    'kill all instances of excel
    'For Each proc In System.Diagnostics.Process.GetProcessesByName("EXCEL")
    ' proc.Kill()
    'Next
    Dim excelnacomm As
    New Microsoft.Office.Interop.Excel.Application
    Dim wbnacomm As Microsoft.Office.Interop.Excel.Workbook
            wbnacomm = excelnacomm.Workbooks.Open("http://test.xlsx")(renamed
    the excel)
            wbnacomm.RefreshAll()
            wbnacomm.Save()
            wbnacomm.Close()
            excelnacomm.Quit()
            Runtime.InteropServices.Marshal.ReleaseComObject(excelnacomm)
    End Sub
    End
    Class
    Please let me know what could be the reason
    Smash126

    Download:
    Microsoft Office 2010: Primary Interop Assemblies Redistributable
    How to: Add or Remove References By Using the Add Reference Dialog Box  /  How to:
    Add and Remove References in Visual Studio (C#)
    Olaf Helper
    [ Blog] [ Xing] [ MVP]

  • Error while sending mail using script task in ssis 2008

    Hi,
        i am trying to send mail using ssis 2008 script task.for my requirement i am not able to use send mail task.
    code i have used is
    declared read only variables system::packagename
     Dim PACKAGE As String
            PACKAGE = Dts.Variables("System::PackageName").Value.ToString()
            Dim myHtmlMessage As MailMessage
            Dim mySmtpClient As SmtpClient
            myHtmlMessage = New MailMessage("[email protected]", "[email protected]", "PACKAGE STATUS", PACKAGE + "WAS FAILED")
         mySmtpClient = New SmtpClient("smtp.gmail.com")
            mySmtpClient.Credentials = New NetworkCredential("[email protected]", "mypassword")
            mySmtpClient.EnableSsl = True
            mySmtpClient.Port = 587
            mySmtpClient.Send(myHtmlMessage)
    error i am getting is
    Error: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Net.Mail.SmtpException: The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1
    Authentication Required. Learn more at
       at System.Net.Mail.MailCommand.CheckResponse(SmtpStatusCode statusCode, String response)
       at System.Net.Mail.MailCommand.Send(SmtpConnection conn, Byte[] command, String from)
       at System.Net.Mail.SmtpTransport.SendMail(MailAddress sender, MailAddressCollection recipients, String deliveryNotify, SmtpFailedRecipientException& exception)
       at System.Net.Mail.SmtpClient.Send(MailMessage message)
       at ST_c121e07caaa94c21bb1355d4f753112f.vbproj.ScriptMain.Main()
       --- End of inner exception stack trace ---
       at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
       at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
       at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
       at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
       at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
       at System.Type.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, CultureInfo culture)
       at Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTATaskScriptingEngine.ExecuteScript()
    can any one tell me where i am going wrong

    also getting error as follows
    Error: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Net.Mail.SmtpException: The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1
    Authentication Required. Learn more at
       at System.Net.Mail.MailCommand.CheckResponse(SmtpStatusCode statusCode, String response)
       at System.Net.Mail.MailCommand.Send(SmtpConnection conn, Byte[] command, String from)
       at System.Net.Mail.SmtpTransport.SendMail(MailAddress sender, MailAddressCollection recipients, String deliveryNotify, SmtpFailedRecipientException& exception)
       at System.Net.Mail.SmtpClient.Send(MailMessage message)
       at ST_c121e07caaa94c21bb1355d4f753112f.vbproj.ScriptMain.Main()
       --- End of inner exception stack trace ---
       at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
       at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
       at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
       at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
       at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
       at System.Type.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, CultureInfo culture)
       at Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTATaskScriptingEngine.ExecuteScript()

  • How to load data into table Using Script Task

    We have a directory/folder where we have a file. We need to insert the File Created Date , File Name , Extension into the database table of Sql server by using Script Task.
    So could you please suggest , how to frame the connection string , fetch the file details and insert the data into the database table using Script Task of SSIS 2008

    You can achieve it as follows using standard script task
    1. Add a ForEachLoop container to point to your directory to iterate though the files. Add a variable of type string inside loop to get file name of each file it iterates. Choose option Filename and extension. Add a variable to just store extension part
    (FileExtension), set EValuateAsExpression true for it and give expression as below
    SUBSTRING(@[User::FileName],FINDSTRING(@[User::FileName],".",1)+1,LEN(@[User::FileName]))
    2. Add a script task inside loop and pass filename variable as a read only variable to it. Crete a new variable to get creationdate and pass it as ReadWrite. Inside write code as below
    Public Sub Main()
    ' Add your code here
    Dim f As New System.IO.FileInfo(Dts.Variables("FileName").Value.ToString())
    Dts.Variables("FileCreatedDate").Value = f.CreationTime
    Dts.TaskResult = ScriptResults.Success
    End Sub
    3. Add a Exec SQL Task after Script task inside loop and give a query like below
    INSERT INTO TableName (FileName,CreatedDate,Extension)
    VALUES(?,?,?)
    and in parameter tab map the parameter placeholders 0,1 and 2 to @[User::FileName],@[User::FileCreatedDate] & @[User::FileExtension] variables
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Getting "Couldnot find Installable ISAM" error in script task in SSIS 2005 when trying to open (.xlsx files) Excel 2007-2010 files using VB script in Visual Studio 2005

    Hi Experts,
    I am trying to open .xlsx file in script task of SSIS 2005. I am using the 32-bit AccessDatabaseEngine driver with the Connection string as "Provider= Microsoft.ACE.OLEDB.12.0; Data Source=xlsx file path; Extended Properties="Excel 12.0 Xml;
    HDR=YES"" in script task.
    When we debug the VB script in Visual Studio 2005 and encounters the statement app.open() it throws the error "Couldn't find installable ISAM".
    My SQL server version is 2005 SP2 DE
    OS is Windows server 2003 EE SP2
    Could anyone please let me know what is the resolution for this error?
    Thanks and Regards,
    Adesh

    Hi Adesh,
    First, make sure the package runs in 32-bit runtime mode (set Run64BitRuntime property to False) because you are using the 32-bit ACE OLE DB Provider. If it is not the case, the issue may occur due to the corrupted drivers or registry keys. You can try to
    reinstall the 2007 Office System Driver: Data Connectivity Components as Arthur suggested.
    Regards,
    Mike Yin
    TechNet Community Support

  • How can apply configure file in ssis by using script task ?

    I had  two config file in ssis
     1. config file as per QA
    2. config file as per Production
     I think apply dynamically by using script task for above file (acc to server)
    How can I apply in script task for config file path in C# script
    any one provide Helpful code ??
    Thanks

    I applied script Task  with below code :
    public void Main()
    //User::Config,User::Config_Pd,User::Config_QA
    Application App = new Application();
    Package Pack = new Package();
    DTSExecResult pkgResults;
    string strPackageName;
    string filename = "";
    string configvalue;
    configvalue = Dts.Variables["Config"].Value.ToString();
    strPackageName = Directory.GetCurrentDirectory().ToString() + "\\Excel Reports from Remittance advice\\Child.dtsx";
    try
    Pack = App.LoadPackage(strPackageName, null);
    if (Pack != null)
    if (configvalue == "DEV")
    filename = Dts.Variables["Config_QA"].Value.ToString();
    else if (configvalue == "PROD")
    filename = Dts.Variables["Config_Pd"].Value.ToString();
    else
    Dts.TaskResult = (int)ScriptResults.Failure;
    System.Windows.Forms.MessageBox.Show("Unable to bind the XML Configurations");
    return;
    } System.Windows.Forms.MessageBox.Show("Config:"+filename);
    Pack.ImportConfigurationFile(@filename);
    Pack.EnableConfigurations = true;
    Pack.Configurations.Add();
    App.SaveToXml(strPackageName, Pack, null)
    pkgResults = Pack.Execute(); //Pack.Execute();
    System.Windows.Forms.MessageBox.Show("Results:" + pkgResults.ToString());
    Dts.TaskResult = (int)ScriptResults.Success;
    But ouput in ssis showing as
    But some thing missed in code  plz help me ...

  • Number of rows inserted is different in bulk insert using select statement

    I am facing a problem in bulk insert using SELECT statement.
    My sql statement is like below.
    strQuery :='INSERT INTO TAB3
    (SELECT t1.c1,t2.c2
    FROM TAB1 t1, TAB2 t2
    WHERE t1.c1 = t2.c1
    AND t1.c3 between 10 and 15 AND)' ....... some other conditions.
    EXECUTE IMMEDIATE strQuery ;
    These SQL statements are inside a procedure. And this procedure is called from C#.
    The number of rows returned by the "SELECT" query is 70.
    On the very first time call of this procedure, the number rows inserted using strQuery is *70*.
    But in the next time call (in the same transaction) of the procedure, the number rows inserted is only *50*.
    And further if we are repeating calling this procedure, it will insert sometimes 70 or 50 etc. It is showing some inconsistency.
    On my initial analysis it is found that, the default optimizer is "ALL_ROWS". When i changed the optimizer mode to "rule", this issue is not coming.
    Anybody faced these kind of issues?
    Can anyone tell what would be the reason of this issue..? any other work around for this...?
    I am using Oracle 10g R2 version.
    Edited by: user13339527 on Jun 29, 2010 3:55 AM
    Edited by: user13339527 on Jun 29, 2010 3:56 AM

    You have very likely concurrent transactions on the database:
    >
    By default, Oracle Database permits concurrently running transactions to modify, add, or delete rows in the same table, and in the same data block. Changes made by one transaction are not seen by another concurrent transaction until the transaction that made the changes commits.
    >
    If you want to make sure that the same query always retrieves the same rows in a given transaction you need to use transaction isolation level serializable instead of read committed which is the default in Oracle.
    Please read http://download.oracle.com/docs/cd/E11882_01/appdev.112/e10471/adfns_sqlproc.htm#ADFNS00204.
    You can try to run your test with:
    set  transaction isolation level  serializable;If the problem is not solved, you need to search possible Oracle bugs on My Oracle Support with keywords
    like:
    wrong results 10.2Edited by: P. Forstmann on 29 juin 2010 13:46

  • Scripting Language Options for the Script Task Options SSIS 2012

    Can python or perl be used as a script language in the drag and drop script task? I believe only VB.Net and C# are, but I see under SSDT Tools -> Options there are some choices for Python Debugging? I'd like to use python as my SSIS scripting language
    in some cases. If it can not be used as the script task language, what are the Python options under Tools -> Options for?
    Any experts out there who can illuminate?
    Thanks all

    Hello,
    In SSDT in a SSIS Script task you can only use Visual Basic.NET and C#, no other programming / scripting languages.
    SSDST is a plugin for Visual Studio and in VS you will find several options which are irrelevant for SSIS projects, like this Phyton debugging option.
    Olaf Helper
    [ Blog] [ Xing] [ MVP]

  • Convert ActiveX DTS script task to SSIS Script task - Please help

    Hello,
    I Have a ActiveX script that was used in a DTS package but I'm currently trying to convert all my DTS packages to SSIS.The script is tasked to run the package on a daily basis. Everything works fine except the ActiveX script. It gives an error on my DTSGlobalVariables.parent,
    I looked up this error and changed it to "DTS.Variables("User::VariableName").Value", in
    the SSIS script task (in VB) but now I'm getting error: 
    Microsoft.SqlServer.Dts.Runtime.DtsRuntimeException: The element cannot be found in a collection.
    ---> System.Runtime.InteropServices.COMException (0xC0010009): The element cannot be found in a collection.
    bij Microsoft.SqlServer.Dts.Runtime.Wrapper.IDTSVariables100.get_Item(Object Index)
    bij Microsoft.SqlServer.Dts.Runtime.Variables.get_Item(Object index)
    --- Einde van intern uitzonderingsstackpad ---
    bij Microsoft.SqlServer.Dts.Runtime.Variables.get_Item(Object index)
    bij ST_f32fc12b60f34bebbbdfc0c5e5b40a96.vbproj.ScriptMain.Main()
    --- Einde van intern uitzonderingsstackpad ---
    bij System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
    bij System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
    bij System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
    bij System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
    bij System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
    bij System.Type.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, CultureInfo culture)
    I have tried to convert this ActiveX script into a SSIS script task in VB but I know hardly any VB... So I'm wondering what the best course of action for me is, should I try to convert it into the script task like I am trying now, if so, how do I make it
    work?
    Any help would be really really welcome.
    This is the original ActiveX script that needs to be converted:
    ' Visual Basic ActiveX Script
    Function Main()
    Dim sEnvironm
    Dim sServer
    Dim sSourceFile
    Dim sSourcePath
    Dim sBackupPath
    Dim sErrorPath
    Dim sFileName
    Dim sUDLPath
    ' Set vars
    ' First 2 are depending on the server and db
    ' FILL IN THE RIGHT VALUES
    sEnvironm = "MON_Datamart"
    sServer = "BrechtProesmans"
    ' --- DO NOT CHANGE ANYTHING BELOW THIS LINE ---
    sSourceFile = "C:\Program Files\Microsoft SQL Server\MON_Datamart\SourceFiles\tbl_L00T1.txt"
    sSourcePath = "C:\Program Files\Microsoft SQL Server\MON_Datamart\SourceFiles\"
    sBackupPath = "C:\Program Files\Microsoft SQL Server\MON_Datamart\BackupFiles\"
    sErrorPath = "C:\Program Files\Microsoft SQL Server\MON_Datamart\ErrorFiles\"
    sFileName = "tbl_L00T1.txt"
    sUDLPath = "C:\Program Files\Microsoft SQL Server\MON_Datamart\MON_Datamart.udl"
    ' Initial
    FoundError = False
    ' Get a handle to the Package object.
    Set oPackage = DTSGlobalVariables.Parent
    ' Update DTSConnections
    Set oConnection = oPackage.Connections("tbl_L00T1.txt")
    oConnection.DataSource = sSourceFile
    Set oConnection = oPackage.Connections("Datamart")
    oConnection.UDLPath = sUDLPath
    Set oConnection = oPackage.Connections("Truncate")
    oConnection.UDLPath = sUDLPath
    ' Update DTSTasks
    Set oTask = oPackage.Tasks("DTSTask_DTSDataPumpTask_1").CustomTask
    oTask.SourceObjectName = sSourceFile
    oTask.DestinationObjectName = sEnvironm & ".dbo.stg_tbl_L00T1"
    ' Set Global vars
    DTSGlobalVariables("SourcePath").Value = sSourceFile
    DTSGlobalVariables("BackupPath").Value = sBackupPath
    DTSGlobalVariables("ErrorPath").Value = sErrorPath
    DTSGlobalVariables("FileName").Value = sFileName
    ' Clean up.
    Set oTask = Nothing
    Set oConnection = Nothing
    Set oPackage = Nothing
    Main = DTSTaskExecResult_Success
    End Function

    Set a breakpoint and tell us on what line it dies, at the same time, you can inspect the variable values in the Auto window (if there are) as it merely perhaps is an issue with values not being passed in.
    Arthur
    MyBlog
    Twitter

  • Unable to Open Script task in SSIS packages in Microsoft visual studio

    TITLE: Microsoft Visual Studio
    The task with the name "Map Network Drive" and the creation name "Microsoft.SqlServer.Dts.Tasks.ScriptTask.ScriptTask, Microsoft.SqlServer.ScriptTask, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" is not registered
    for use on this computer.
    Contact Information:
    Script Task
    BUTTONS:
    OK

    Hi Covaikumar,
    The issue may occur because the Script Task is not installed properly. Please check whether the Microsoft.SqlServer.ScriptTask.dll file exists in the following folders (supposing it is a 64-bit platform):
    C:\Program Files\Microsoft SQL Server\110\DTS\Tasks
    C:\Program Files (x86)\Microsoft SQL Server\110\DTS\Tasks
    C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.SqlServer.ScriptTask\v4.0_11.0.0.0__89845dcd8080cc91
    If the Microsoft.SqlServer.ScriptTask.dll file is missing in any of the folders, copy one (from the other folders or a different working SSIS server) to the folder. Alternatively, you can also use the command line tool gacutil.exe to install the task assembly
    into the global assembly cache (GAC).
    Regards,
    Mike Yin
    TechNet Community Support

  • Using Script Task to rename an excel sheet.

    I'm trying to use an SSIS Script Task to rename an excel sheet.
    I've found several code samples on the net but most don't compile correctly and my knowledge of VB.net or C# isin't strong enough to fix the issues. I suspect they work but not for SSIS 2012 possibly.
    Found the sample below which shows no errors at design time, but fails with an Invocation error so I'm unable to even trap what the error is to help in resolving the issue.
    Does anyone have any sample code that they KNOW WORKS in SSIS 2012 or can see what the problem is ?
    Dim oMissing As Object = System.Reflection.Missing.Value
            Dim xl As New Microsoft.Office.Interop.Excel.ApplicationClass()
            Dim xlBook As Microsoft.Office.Interop.Excel.Workbook
            Dim xlSheet As Microsoft.Office.Interop.Excel.Worksheet
            Dim laPath As String = "C:\Test.xlsx"
            Try
                xlBook = DirectCast(xl.Workbooks.Open(laPath, oMissing, oMissing, oMissing, oMissing, oMissing, _
                oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, _
                oMissing, oMissing, oMissing), Workbook)
                xlSheet = DirectCast(xlBook.Worksheets.Item(1), Worksheet)
                xlSheet.Name = "Sheet1"
                xlBook.Save()
                xl.Application.Workbooks.Close()
                Dts.TaskResult = ScriptResults.Success
            Catch ex As Exception
                MessageBox.Show(ex.Message.ToString(), "Error", MessageBoxButtons.OK)
                Dts.Events.FireError(1, ex.TargetSite.ToString(), ex.Message.ToString(), "", 0)
                Dts.TaskResult = ScriptResults.Failure
            End Try
    Thanks.

    Why do you need a script task for this? You can define the sheetname at the time of data transfer itself by creating a new sheet with required name
    See this as an example
    http://visakhm.blogspot.in/2013/09/exporting-sqlserver-data-to-multiple.html
    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

  • Unable to initiate BPM process despite using script task

    Hi,
    I've created a BPMN process which I want to initiate through a script task - I followed the steps given in section 3.7 of the following doc -
    https://stbeehive.oracle.com/content/dav/st/HP%20personal%20workspace/Public%20Documents/BPMN_03_SalesQuote_Implementation.pdf
    but after deploying this process, when I go to BPM workspace using my user's login, I don't see my BPM process under list of applications. What could be wrong?
    Thanks,
    Harsh

    Hi Lavanya,
    Could you please tell me how you resolved. I am also getting same error.
    com.sap.glx.adapter.api.AdapterException: Process start failed due to TransitionException
    Thanks in advance.
    cheers,
    dev

  • Mail sending is failed in script task in ssis

    Hi guys,
    I have an issue in ssis script task. I have a script which sends the mail after completion of ETL.
    It is giving the following error when it tries to send the mail in script task.
    System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Net.Mail.SmtpException: Failure sending mail. ---> System.Net.WebException: The remote name could not be resolved: 'smtp.gmail.com'
    when we searched in the web some people are saying that it may be an issue of smtp server. so we have tried to ping the smtp.gmail.com. but when we try to ping smtp server from command prompt for the first time it is not pinging and giving the following error:
    "Ping request could not find host smtp.gmail.com. Please check the name and try again."
    If we again ping for the second time then it pinging without any loss (0% loss).
    we uanble to find out why it is behaving like this.
    Please help if anybody has any idea on this.
    Thanks in advance.
    Nagaraj

    sp_configure ‘show advanced options’, 1;
    GO
    RECONFIGURE;
    GO
    sp_configure ‘Database Mail XPs’, 1;
    GO
    RECONFIGURE
    GO
    Port should be open 587 .
    You can check email had send following:-SELECT * FROM msdb..sysmail_mailitemsSELECT items.subject,items.last_mod_date,l.description FROM dbo.sysmail_faileditems select * from msdb.dbo.sysmail_event_log 

  • 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.

  • HOW to USE 'LONG RAW' in Bulk Insertion using OCI

    Hi,
    I need to do bulk insertion of LONG RAW data into a table using the OCI.
    To the OCIBindByPos API what should I specify in the field size(value_sz). As different records can have different lenght for this LONG RAW data what value should I provide.
    Thanks,
    Tuhin
    sword OCIBindByPos ( OCIStmt *stmtp,
    OCIBind **bindpp,
    OCIError *errhp,
    ub4 position,
    dvoid *valuep,
    sb4 value_sz,
    ub2 dty,
    dvoid *indp,
    ub2 *alenp,
    ub2 *rcodep,
    ub4 maxarr_len,
    ub4 *curelep,
    ub4 mode );

    ORA-00997: illegal use of LONG datatype
    Cause: A value of datatype LONG was used in a function or in a DISTINCT, WHERE, CONNECT BY, GROUP BY, or ORDER BY clause. A LONG value can only be used in a SELECT clause.
    Action: Remove the LONG value from the function or clause
    Are you using the column anywhere else but in the SELECT?

Maybe you are looking for