SQL Function in a SSIS package

I have data that I am importing from multiple DB2 servers.
I have a SQL function that I need to run to process the DB2 data after it is imported.
Does anyone know if there is a way to do this.  Call a SQL function to process data imported from a non-MSSQL server.
Or should I use a staging table and use a stored procedure instead of a function.
Thanks in advance.

Function? A function you wrote on the SQL Server side like a scalar-valued function?
If you say yes, then you can re-use it by having a staging table - just run the proper T-SQL against it.
If not then use a staging table and use a stored procedure instead of a function
Arthur
MyBlog
Twitter

Similar Messages

  • How do I automatically backup SQL Agent jobs and SSIS packages on the mirror daily?

    I have seen this question asked before but I could not find a satisfactory answer. What is the best solution to get your SQL Agent jobs/schedules/etc. and your SSIS packages on the mirror server? Here's the details:
    Server A is the principal with 2 DBs mirrored over to server B. Everything is fine and dandy, DBs are synched and all good. In Disaster Recovery testing, we need to bring up server B, which now will serve as the principal. Server A is inaccessible. Now,
    we need all our jobs that are setup in server A to be in server B, ready to go, but disabled. We also need all our SSIS packages properly stored. Yes, we store our packages in the MSDB in server A.
    Now, I can see a few answers coming my way.
    1- Backup the MSDB to server B. When you bring server B up as principal in DR, restore the MSDB. All your jobs,schedules,steps, SSIS packages will be there. Is this possible? Can this be done on server B without rendering it incapable of serving as the principal
    for the mirrored DBs? My fear with this option is that there may be information in the MSDB itself about the mirroring state of the DBs? Or is all that in the Master DB? Have you tried this?
    2- Right click each job, script them out, re-create them on server B... No, thank you very much. :) I am looking for an AUTOMATED, DAILY backup of the jobs and SSIS packages. Not a manual process. Yes, we do change jobs and packages quite often and doing
    the job twice on two servers is not an option.
    3- Use PowerShell.. Really? Are we going back to scripting at the command prompt like that, that fast?
    Since I fear option number 3 will be the only way to go, any hints on scripts you guys have used that you like that does what I need to do?
    Any other options?
    Any help GREATLY appreciated. :-) I can be sarcastic but I am a good guy..
    Raphael
    rferreira

    I would go with option number 3. Once  you have a script simple run it....
    param([string]$serverName,[string]$outputPath) 
    function script-SQLJobs([string]$server,[string]$outputfile) 
        [reflection.assembly]::LoadWithPartialName("Microsoft.SqlServer.Smo") | Out-Null 
        $srv = New-Object Microsoft.SqlServer.Management.Smo.Server("$server") 
        $db = New-Object Microsoft.SqlServer.Management.Smo.Database 
        $scrp = New-Object Microsoft.SqlServer.Management.Smo.Scripter($srv) 
        $scrp.Options.ScriptDrops = $FALSE 
        $scrp.Options.WithDependencies = $TRUE 
        $jobs = $srv.JobServer.get_Jobs() 
        $jobs=$jobs | Where-Object {$_.Name -notlike "sys*"}     
        foreach($job in $jobs) 
            $script=$job.Script() 
            $script >> $outputfile 
            "GO" >> $outputfile 
    ---script-SQLJobs "SQLSRV12" "C:\Jobs\test.txt" 
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Blog:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance

  • SQL Server Agent running SSIS package fails Unable to determine if the owner of job has server access

    I have a web application developed through VS 2012 which has a button on a form that when operated starts a SQL Server agent job on the server that runs an SSIS package.  The website and the instance of SQL Server with the agent and SSIS package are
    on the same windows 2008 r2 server.  When the button is operated no exceptions are raised but the SSIS package did not execute.
    When I look in the logfileviewer at the job history of the sql server agent job I see that the job failed with message...
    The job failed.  Unable to determine if the owner (DOMAINNAME\userid) of job runWebDevSmall has server access (reason: Could not obtain information about Windows NT group/user 'DOMAINNAME\userid'<c/> error code 0x6e. [SQLSTATE 42000] (Error 15404)).,00:00:00,0,0,,,,0
    ...even though DOMAINNAME\userid is in the logins for the sql server and has admin authorities.
    Could someone show me what I need to do to get this to run?  Thanks tonnes in advance for any help, Roscoe

    This can happen when the network is too slow to allow a timely completion of the verification. Or the account running has no such right.
    I suggest you try using the SA account for the job as it does not require to poll the AD.
    Arthur My Blog

  • SQL Server Version running SSIS Package

    I´m trying to run an SSIS 2013 Package in SQL Server 2014 but i keep getting the error "package migration from version 8 to version 6 failed with error".
    So i ckecked the vertion in SQL Server 2014 using a T-SQL query:
    SELECT @@VERSION
    and i got:
    "Microsoft SQL Server 2012 (SP1) - 11.0.3153.0 (X64) Jul 22 2014 15:26:36 Copyright (c) Microsoft Corporation Enterprise Edition: Core-based Licensing (64-bit) on Windows NT 6.1 (Build 7601: Service Pack 1) "
    The response for this query should be SQL Server 2014, right?
    What should i do to alter this?

    I think what you meant was SSIS package created using VS 2013. If yes, it will work only on SSIS 2014 server. What you've there is SQL/SSIS 2012 version as shown by @@VERSION result
    http://blogs.msdn.com/b/analysisservices/archive/2014/04/03/sql-server-data-tools-business-intelligence-for-visual-studio-2013-ssdt-bi.aspx
    SO you should be using SSIS 2014 if you want to deploy the packages
    Otherwise use VS 2010 or 2012 SSIS templates for deploying to 2012 server
    Please Mark This As Answer if it solved your issue
    Please Mark This As Helpful if it helps to solve your issue
    Visakh
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • SQL agent scheduling for SSIS package

    I have a package with a souce and destination connection using login as 'sa'.
    I created a scheduling task to call this package for running. However the sql agent service is running as domain user . It required to be running as domain user as per requirement.
    Thus when I scheduling the package for execution, it hit error.
    Please advise what I can do in order to be able schedule the ssis package?
    Thanks in advance.

    Here is the step that I create the proxy :
    https://www.simple-talk.com/sql/database-administration/setting-up-your-sql-server-agent-correctly/
    I try to create the proxy but still have error as below:
    Executed as user: YS2H\svr_agent. Microsoft (R) SQL Server Execute Package Utility  Version 10.50.2500.0 for 32-bit  Copyright (C) Microsoft Corporation 2010. All rights reserved.    Started:  8:21:26 AM  Error: 2015-03-27
    08:21:26.24     Code: 0xC0016016     Source:       Description: Failed to decrypt protected XML node "DTS:Password" with error 0x8009000B "Key not valid for use in specified
    state.". You may not be authorized to access this information. This error occurs when there is a cryptographic error. Verify that the correct key is available.  End Error  Error: 2015-03-27 08:21:26.44     Code: 0xC0016016    
    Source:       Description: Failed to decrypt protected XML node "DTS:Password" with error 0x8009000B "Key not valid for use in specified state.". You may not be authorized to access this information. This error
    occurs when there is a cryptographic error. Verify that the correct key is available.  End Error  Error: 2015-03-27 08:21:27.03     Code: 0xC0202009     Source: 1001_Import_DownloadRoadCard Connection manager
    "Destination"     Description: SSIS Error Code DTS_E_OLEDBERROR.  An OLE DB error has occurred. Error code: 0x80040E4D.  An OLE DB record is available.  Source: "Microsoft SQL Server Native Client 10.0" 
    Hresult: 0x80040E4D  Description: "Login failed for user 'sa'.".  End Error  Error: 2015-03-27 08:21:27.03     Code: 0xC00291EC     Source: Evaluate Completion Status Execute SQL Task    
    Description: Failed to acquire connection "Destination". Connection may not be configured correctly or you may not have the right permissions on this connection.  End Error  Error: 2015-03-27 08:21:27.05     Code: 0xC0202009    
    Source: 1001_Import_DownloadData Connection manager "Destination"     Description: SSIS Error Code DTS_E_OLEDBERROR.  An OLE DB error has occurred. Error code: 0x80040E4D.  An OLE DB record is available.  Source:
    "Microsoft SQL Server Native Client 10.0"  Hresult: 0x80040E4D  Description: "Login failed for user 'sa'.".  End Error  Error: 2015-03-27 08:21:27.05     Code: 0xC00291EC     Source:
    Record Start of Job Execute SQL Task     Description: Failed to acquire connection "Destination". Connection may not be configured correctly or you may not have the right permissions on this connection.  End Error  DTExec:
    The package execution returned DTSER_FAILURE (1).  Started:  8:21:26 AM  Finished: 8:21:27 AM  Elapsed:  0.983 seconds.  The package execution failed.  The step failed.
    Thanks for your help.

  • SQL Agent job step - SSIS package - adding a config file - will it override the one that the package specifies?

    If I setup a job step to run a package and set the config file location on the "Configurations" tab, will that override the config file that the SSIS package is configured to use?  Or is this a "cumulative" type configuration option?
    I typically have my config file mixed in with my project files, but that path wont exist on the server.

    Hi Shiftbit,
    ETL vs ELT is right.
    In SSIS 2005, the DTExec utility loads and runs the package, events occur in the following order:
    The package file is loaded.
    The configurations specified in the package at design time are applied in the order specified in the package (except for Parent Package Variables).
    Any options specified from the command line are applied. Any configurations specified on the command line overwrite the current values; however, they do not trigger a reload of the configurations if a changed value impacts a configuration dependency. For
    example, if the connection string used for SQL Server configurations is updated from the command line at run time, the package will still retain any other values from the design-time SQL Server configuration database.
    Parent Package Variable Configurations are applied.
    The package is run.
    In SSIS 2008 and higher, utility loads and runs the package, events occur in the following order:
    The dtexec utility loads the package.
    The utility applies the configurations that were specified in the package at design time and in the order that is specified in the package. (The one exception to this is the Parent Package Variables configurations. The utility applies these configurations
    only once and later in the process.)
    The utility then applies any options that you specified on the command line.
    The utility then reloads the configurations that were specified in the package at design time and in the order specified in the package. (Again, the exception to this rule is the Parent Package Variables configurations). The utility uses any command-line
    options that were specified to reload the configurations. Therefore, different values might be reloaded from a different location.
    The utility applies the Parent Package Variable configurations.
    The utility runs the package.
    So, we can see that no matter we use SSIS 2005 which applies the Configurations once or use SSIS 2008 (or higher) which applies the configurations twice, the configurations specified in the command line will affect and not be overwritten by the configurations
    specified at design-time.
    Reference:
    http://technet.microsoft.com/en-us/library/ms141682(v=sql.110).aspx.
    Regards,
    Mike Yin
    TechNet Community Support

  • Issue in using SQL Authentication in child SSIS packages from Parent SSIS package.

    I am trying to provide SQL Authentication mode and credentials at parent package and I am using some child pachnages been called from this package.
    How can I resolve this to use SQL authentication.
    I am using 2008 Version
    Thanks
    Sreenath
    Sreenath G V

    Hi Sreenath,
    What issue did you encounter when run the parent package? It should work properly if the SQL Server Authentication is already enabled on the target SQL Server instance and the SQL account credentials are input correctly in the child package.
    You may encounter issue if you have enabled Package Configurations for the child pages that use SQL Server authentication and selected to expose the UserName and Password for the SQL Server connection. In this situation, the password won’t be exposed to
    the package configurations explicitly, hence, the Dtexec utility cannot fetch the password for the connection and fails the package execution. If it is the issue, you have to specify the password for the SQL Server account in the package configurations file.
    Regards,
    Mike Yin
    TechNet Community Support

  • SQL job containing a SSIS package

    Hi,
    I'm trying to run a job that executes a SSIS package.
    Some of the blocks in the SSIS package refers to files stored on network folders.
    Each time i run the job manually i get an error message saying that the file can not be opened because it is already opened or because i have no permission to access it.
    If i move the file to a local folder and change the SSIS package accordingly than the job runs fine.
    what settings should i change in order for the job to be able to access the network folder?
    Thanks, Udi

    Hi
    Check the account which executes the job has access permission on the network folder.
    thanks
    Mushtaq

  • SQL Server 2012 save SSIS package in MSDB

    I am trying to save my package in MSDB database from SQL Server Data Tools 2012 (used to be called BIDS as you know). However, when I go to File --> Save mypackage.dtsx As, it only allows me to save it as File System, not in a SQL Server MSDB database!
    Is there a setting that I need to re-adjust? Thanks for your tip.

    Olaf, thank you for that clarification and curing my headache.
    Unfortunately the documentation from MS is very confusing and options for 2008 are intertwined with 2012. For example when looking at
    http://msdn.microsoft.com/en-us/library/ms137731.aspx one starts reading about SSISDB, but the topics underneath that are mistitled and talks about backwards compatibility and MSDB deployment.
    The heading in the menu is titled "Manage the Integration Services Service" yet the title of the article is "Manage the Legacy Integration Services Service". The sections under
    http://msdn.microsoft.com/en-us/library/bb522537.aspx have (SSIS) in the title, but the one i mentioned above is referred to as (SSIS Service). This threw me for a loop of confusion and
    a half.

  • How to load a comma seprated text file which contain address in to sql server table using ssis package

    Hi,
    I want to load a file which is comma separated and contain address .Problem is that address its self comma seprated so how do I differenciate whether comma used for column seprator or it used in address.
    for eg.
    One person having address like
    "c/o AB corp,156 cross lane,USA"
    Thanks.....

    Hi SR_MCTS,
    Based on your description, you want to distinguish a comma is used for column separator or used in address column in a text file, then load the data from the text file to SQL Server table.
    As per my understanding, if you can replace the comma column separator to another delimiter like semicolon (;), just do it. Then we can select Semicolon {;} as Column delimiter for the Flat File Connection Manager. Or ensure all columns are enclosed in double
    quotes ("). Then we can set the double quotes (") as Text qualifier for the Flat File Connection Manager, and the commas will be loaded as part of the string fields.
    If you can't have that done, because computers don't know the context of the data, you would have to come up with some kind of rules that decides when a comma represents a delimiter, and when it is just part of the text. I think a custom script component
    would be necessary to pre-process the data, identify where a comma is part of an address, and then treat that as one field.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • SSIS package give an error if execute through SQL server agent

    I have created a SSIS package in BIDS 2012. If i execute this package through sql server agent it gives the below error:
    Executed as user: NT Service\SQLSERVERAGENT. Microsoft (R) SQL Server Execute Package Utility  Version 11.0.2100.60 for 64-bit  Copyright (C) Microsoft Corporation. All rights reserved.    Started:  11:19:47 AM  Error: 2015-01-20
    11:19:47.83     Code: 0xC0016016     Source: Sub_Hadoop_aggregation      Description: Failed to decrypt protected XML node "DTS:Password" with error 0x8009000B "Key not valid for use in specified state.".
    You may not be authorized to access this information. This error occurs when there is a cryptographic error. Verify that the correct key is available.  End Error  Error: 2015-01-20 11:19:47.94     Code: 0xC0016016     Source:
    Sub_Hadoop_aggregation      Description: Failed to decrypt protected XML node "DTS:Password" with error 0x8009000B "Key not valid for use in specified state.". You may not be authorized to access this information. This error
    occurs when there is a cryptographic error. Verify that the correct key is available.  End Error  Error: 2015-01-20 11:19:48.04     Code: 0xC0016016     Source: Sub_Hadoop_aggregation      Description: Failed to
    decrypt protected XML node "DTS:Password" with error 0x8009000B "Key not valid for use in specified state.". You may not be authorized to access this information. This error occurs when there is a cryptographic error. Verify that the correct
    key is available.  End Error  Error: 2015-01-20 11:19:48.92     Code: 0xC00291EC     Source: alter_keys Execute SQL Task     Description: Failed to acquire connection "mstr_warehouse". Connection may not be
    configured correctly or you may not have the right permissions on this connection.  End Error  DTExec: The package execution returned DTSER_FAILURE (1).  Started:  11:19:47 AM  Finished: 11:19:48 AM  Elapsed:  1.42 seconds.
     The package execution failed.  The step failed.
    so i have change some properties in our package like protectionlevel change from encrypted to dontsavesensitive. After that i have created configuration file for the package and use that configuration file. It executes the package through sql server agent
    smoothly.
    Thanks
    Azhar Khan

    Hi selfdestruct80,
    According to your description, you created SSIS package and it works fine. But you got the error message when the SSIS package was called from a SQL Server Agent job.
    According to my knowledge, the package may not run in the following scenarios:
    The current user cannot decrypt secrets from the package.
    A SQL Server connection that uses integrated security fails because the current user does not have the required permissions.
    File access fails because the current user does not have the required permissions to write to the file share that the connection manager accesses.
    A registry-based SSIS package configuration uses the HKEY_CURRENT_USER registry keys. The HKEY_CURRENT_USER registry keys are user-specific.
    A task or a connection manager requires that the current user account has correct permissions.
    According to the error message, the SSIS Package ProtectionLevel property to EncryptSensitiveWithPassword as ArthurZ mentioned. To solve the problem, you need to go to Command Line tab, manually specify the paassword in SQL Agent Job with the command like below:
    /FILE "\"C:\Users\xxxx\Documents\SQL Server Management Studio\SSIS\Package.dtsx\"" /DECRYPT somepassword /CHECKPOINTING OFF /REPORTING E
    If you have any more questions, please feel free to ask.
    Thanks,
    Wendy Fu
    Wendy Fu
    TechNet Community Support

  • SSIS package is failing in SQL agent job with webserviceTaskException: Service Description cannot be null

    Hi All
    we are using webservice task in our ssis package and the package is successful in SSDT . when we created SQL job using that package it is failing with  webserviceTaskException: Service Description cannot be null.
    we have given access to web service for ssis proxy account  and have access on wsdl file folder  and given access to temp folder .
    what would be the reason for the failure?
    Surendra Thota

    Hi Surenda,
    As per my understanding, the error message is too general. In order to troubleshoot this issue, we should view the detail error message about this job. For more details, please see:
    Troubleshooting Jobs
    SQL Server Agent Error Log
    Besides, since when you call a Microsoft SQL Server Integration Services (SSIS) package outside a SQL Server Agent job step, the SSIS package runs successfully. However, if you do not modify the SSIS package, then execute it via SQL Server Agent job step,
    it fails. The scenario always related to the user account that is used to run the package under SQL Server Agent. Please also verify that the account has access to the Web site or to the Web Service Description Language (WSDL) file for HTTP connection manager.
    References:
    SSIS package does not run when called from a SQL Server Agent job step
    Example using Web Services with SQL Server Integration Services
    Thanks,
    Katherine Xiong
    If you have any feedback on our support, please click
    here.
    Katherine Xiong
    TechNet Community Support

  • Implement a SOAP Request in an SSIS Package that sends a SOAP Message (Env) with Authentication Info, Receives XML FIle?

    We need a small SSIS package to pass a SOAP message to a SOAP server and receive the response xml message. 
    We have the SOAP Endpoint, SOAP Action, and SOAP Message (which contains authentication elements). They work in a Talend Data Integration job (using
    Talend's tSOAP component). A screenshot showing the Talend job and the configuration of the tSOAP component
    is attached.
    We need to implement the same thing in a Microsoft SQL Server 2012 SSIS package but haven't been able to get an SSIS Web Services task to work. 
    We haven't been able to configure it to pass the SOAP Action and SOAP Message.  
    How should this be accomplished in SSIS?
    kholberger

    I guess I was not clear.  The Talend job works perfectly (and it took only a few minutes to configure). 
    I need to replicate the SOAP request function in an SSIS package.  I've been trying to configure an SSIS Web Services Task to do that without success. 
    The SSIS Web Service Task asks for the .wsdl file, which I provide (though the Talend component
    does not ask for it), but the SSIS WST does not ask for the SOAP Action or SOAP message.  The target web service is protected by a security gateway that rejects the SSIS WST request.  Somehow, the Talend tSOAP component sends the
    SOAP message, which contains the security definition and authentication credentials (you can see part of that in the screen shot) which the endpoint accepts.
    The question is: "How does one implement a SOAP web service request in an SSIS package that sends the SOAP Message".
    Thanks.
    kholberger

  • Executing an SSIS package from TSQL without using xp_cmdshell?

    How can I execute an SSIS package from TSQL without using xp_cmdshell?
    I have a web-app which calls some SQL which executes my SSIS package (a DTSX file, but stored in the server). But the security policy for my application won't permit me use to xp_cmdshell.
    I want to do this:-
    DECLARE @returncode int
    EXEC @returncode = xp_cmdshell 'dtexec /sq pkgOne"'
    Is there another way for executing a Package without going to the command line (e.g. is there some other system stored proc)?
    Thanks

    Whoa - don't go taking my words as saying "it should work".  I never said that - I just said I know less than you :)  I'm assuming that since the CLR is .Net, and you can launch a package from .Net code, you may be able to do so from the CLR. 
    But... I also know that CLR has lots of restrictions on it, and some of those may cause you to be unable to run it from the CLR.
    One thing I will say - I've never heard of anyone doing this.  That's got to tell you something about:
    Whether it can be done at all... although I think I'd have heard/seen something about how it's not possible.
    Whether it's a good idea... maybe other routes are less trouble.
    Talk to me now on

  • String Substitutions with PL/SQL Function

    Hello, i user APEX 4.2.1.00.08 in Database 11g
    I new in apex and a try to use String Substitutions.
    When I define a String like CONST with static value like '999' in Edit Applications Definition it's work fine.
    But I need to define the same String 'CONST' but with value to return from PL/SQL function like.. Package.function
    It's Possible ??
    Thanks !!

    No, you'll need to use application items instead - or pass the value as parameter to your function.
    Passing parameters like this makes for good practice anyway, since your modules become more testable outside the apex environment, and more robust.

Maybe you are looking for