How to pass parameters to sql agent job run configured ssis package

Hi all,
I have a big problem at my small project.
I build my SSIS package that get its variables values from a configuration file..
and when i build a SQL agent job to run this package in a schedule i set the values of variables in it .. but in run-time the package still get its parameters from the configuration file !??
any help please ?

>SQL agent job to run this package in a schedule i set the values of variables in it
One way, setup a configuration table for the package. Let the package read the values for the variables from there.
Kalman Toth Database & OLAP Architect
SQL Server 2014 Design & Programming
New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012

Similar Messages

  • How to Create a SQL Agent Job For A SSIS Package with Sql Server Authentication

    Hi ALl,
    I have a SSIS package which basically has a data flow task in which i pull the data from one server and copy it into another server and my source server is the one where i dont have windows authentication and i have to only use a sql server authentication
    . This package runs fine if i click the server connection properties type the password and save it.
    Now, my task is to set up a sql agent job which basically uses a proxy account and takes this package from the file system and runs it.But when i try to run this package, its failing with an error saying 
    "Login Failed For rpt5user" where rpt5user is the username for my sql server authentication of the source connection.
    Can someone please help me with any suggestions on how to do this?
    I have heard that we can achieve it by using xml config file which i have never used and i am trying to google around but for no luck.
    So, If someone can please throw any suggestions or ideas on this it would be great.
    Thanks

    You need to add password as a config item and set it from the file source or sql table
    see this as an example
    http://blogs.msdn.com/b/runeetv/archive/2009/12/22/ssis-package-using-sql-authentication-and-dontsavesensitive-as-protectionlevel.aspx
    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 Server 2005 agent job runs a SSIS package ( Analysis Services Processing Task) fails

     Hi,
    SQL Server 2005 standard edition.
     I have a SSIS package which has a  Analysis Services Processing Task. I have tested the package in BIDS and it runs ok. But when I created a agent job and run it from the job it reports error:
    Code: 0xC0012024     Source: Analysis Services Processing Task      Description: The task "Analysis Services Processing Task" cannot run on this edition of Integration Services.
    It requires a higher level edition.
    This is the result of select @@version
    Microsoft SQL Server 2005 - 9.00.4035.00 (Intel X86)   Nov 24 2008 13:01:59   Copyright (c) 1988-2005 Microsoft Corporation  Standard Edition on Windows NT 5.2 (Build 3790: Service Pack 1) 
    Any idea?

     Hi,
    SQL Server 2005 standard edition.
     I have a SSIS package which has a  Analysis Services Processing Task. I have tested the package in BIDS and it runs ok. But when I created a agent job and run it from the job it reports error:
    Code: 0xC0012024     Source: Analysis Services Processing Task      Description: The task "Analysis Services Processing Task" cannot run on this edition of Integration Services. It
    requires a higher level edition.
    This is the result of select @@version
    Microsoft SQL Server 2005 - 9.00.4035.00 (Intel X86)   Nov 24 2008 13:01:59   Copyright (c) 1988-2005 Microsoft Corporation  Standard Edition on Windows NT 5.2 (Build 3790: Service Pack 1) 
    Any idea?
    Anyway, I have found a work around:
    http://technet.microsoft.com/en-us/library/ff929186.aspx

  • SQL Agent not running Script in Package which calls an Excel containing Macro

    I have a script task in SSIS package which calls Excel VBA file containing Macro, this file is on the local drive, when I run this package through SSDT the package works ok and the macro does what it needs to. However when I set up a
    sql agent job to call the package then it fails at the Script task. I have created a credentials and proxy user as my self so I should Have full rights.
    But it fails through the job and not through SSDT, can you advise ?

    Hi Asad,
    Since the error message “Script Task Run Excel: Error: Exception has been thrown by the target of an invocation” is too generic, we should find a way to return full error details from SQL Server Agent job. Firstly, configure logging for the steps you wish
    to keep log data for. Secondly, create a stored procedure to return details of the step at which a job failed based on the job name. Finally, execute the stored procedure. For more details, please refer to the following blog:
    http://www.sqlservercentral.com/articles/SQL+Server+Agent/67726/
    In addition, the following similar two threads are for your references:
    http://sornanara.blogspot.jp/2014/04/code-0x00000001-exception-has-been.html
    https://social.msdn.microsoft.com/Forums/sqlserver/en-US/4a20219e-4a90-41be-acfe-b8846dc2c38a/error-while-executing-a-ssis-package-which-contains-a-script-task-through-sql-server-agent-job?forum=sqlintegrationservices
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • Pass value from SQL agent job step

    Hi 
    I have created one SSIS package and I am scheduling the same using SQL Agent job. Now I want to pass one value from SQL job agent and want to use that value in SSIS package and then run that package.  Can someone point to the solution.
    Aniruddha http://aniruddhathengadi.blogspot.com/

    I have created one parameter on SSIS package named strValue and assigned a empty value "". After that I have created one SQL job and step wherein I have set the value to "Nike" for parameter under Parameters tab.
    Now I am expecting Nike value which I have set on SQL job step should get reflected on SSIS package when I am running my job. Am I doing anything wrong ?
    Aniruddha http://aniruddhathengadi.blogspot.com/
    Not sure what's going wrong but you can have quick look at below step by step tutorial:
    Parameterizing Connections and Values at Runtime Using SSIS Environment Variables (via SQL Agent)
    Cheers,
    Vaibhav Chaudhari

  • 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 Agent job running DTS package running in SQL 2005 is unable to run if job onwer is not logged onto server

    I am currently working on a SQL Server upgrade project for a a client where I am converting old dts packages to SSIS. However for a few of the packages no conversion is allowed to be done. For these few packages I have to use dts legacy components in SQL
    2005 on a windows 2003 server to run them.
    These packages use CAPICOM via an Active X script in the package to envelope connection string data for security within the package. Consequently I have to register the capicom.dll for the job owner (which will execute the job via proxy) and install private
    and public key files via internet explorer. I also do this when I am logged in with my account so i can test the package.
    I have created a SQL Server Agent Job which is used to execute the package. We have a schedule account which is local admin on the server and sysadmin within SQL Server. This account is used to create a credential and then a proxy for the CmdExec subsystem
    is then created based on this credential. A CmdExec job step is then added to the job. The directory of  cmd file which calls the dts package is then entered in the command window.
    Finally a recurring schedule is added to execute the job every 5 minutes. 
    If i am logged in to the server using the scheduled account the schedule runs successfully. I am also able to run the command file manually by double clicking on it. The DTS package is run successfully. However once the schedule is set up and I log off the
    machine and log onto my development machine with my normal account and fire up  SQL Server. I connect to that instance with the schedule and see that the job is failing with and Active X error in the package. From experience with this package this Active
    X  error occurs when the user executing the package has not registered the capicom.dll. This has already been done for the scheduler account because the job runs when the scheduler account is logged in on the server. 
    It almost seems as though the job will only run if the Scheduler account is logged on. If i log directly on to the server with own user account I am able to manually execute the package via the cmd file which indicates that the capciom.dll is registered
    under my account. Yet if I try an run the job in SQL Server when I am logged in under my account (using the scheduler account proxy) then the job fails.
    Does anybody have any idea why this may be happening? Any ideas would be much appreciated

    Run the job SSIS step under a proxy account that is derived from the domain account, non-expiring password and has been set to have all the necessary rights.
    How to is here: http://www.mssqltips.com/sqlservertip/2163/running-a-ssis-package-from-sql-server-agent-using-a-proxy-account/
    Arthur
    MyBlog
    Twitter

  • HOw to avoid DeadLocks when you schedule a Sql Server Agent Job and calling SSIS packages

    Hi All,
    I have scheduled 2 packages in in Sql Server Agent jobs .
    First job which is having Package 1 executing at 11 AM and where I am inserting the data in the table.
    Second job which is having Package 2 executing at 12 AM and where I am updating the data in the table based on the first job inserted records.
    When I am executing my first job it taking more time and executing till 12 AM and from 12 AM my job 2 also starting ,so getting deadlocks conflicts because inserting happening from job1 and updating happening from Job 2.
    How to avoid deadlocks and fix the issue.
    Please Suggest .
    Thanks & Regards,
    Anand

    Hi Anand,
    Here is another solution, you can set the Job 2 not to run based on a schedule, and create another SQL Server Agent Job which starts at 12 AM and run with a specified time interval to execute a SQL statement in which you do the following steps:
    1. Get the status information of Job 1 using the statement:
    DECLARE @i int;
    EXEC @i = msdb.dbo.sp_help_job @job_name = ‘Job Name'
    2. If the value of @i is 1 which means the status of job 1 is success and current time is, then start the job 2. So, the statement is as follows:
    IF @I = 1
    EXEC msdb.dbo.sp_start_job @job_name= ‘Job Name’
    Regards,
    Mike Yin
    TechNet Community Support

  • List of SQL server Agent jobs for a SSIS package

    Hello everyone,
    Can you please help me in trying to list all the jobs that have a particular ssis jobs. I saw that all the jobs and jobs steps with the query:
    SELECT
       Srv.srvname AS ServerName,
       Job.name AS JobName,
       JStep.step_id,
       JStep.step_name AS StepName,
       JStep.command,
       Job.enabled
    FROM   dbo.sysjobs Job
    JOIN   dbo.sysjobsteps JStep
       ON  JStep.job_id = Job.job_id
    JOIN   MASTER.dbo.sysservers Srv
       ON  Srv.srvid = Job.originating_server_id
    --WHERE  JStep.subsystem='SSIS'
    WHERE    JStep.step_name = <Job_step_name>
    And also found sysssispackages table for all ssis packages. But I am not sure how to link the package to job. Please help me.
    Thanks in advance.

    Try this:
    USE MSDB
    GO
    SELECT 
    sj.job_id as JobId,
    sj.name as JobName,
    sjs.step_name as StepName,
    sjs.Command as Command
    FROM sysjobs sj 
    INNER JOIN sysjobsteps sjs
        ON(sj.job_id = sjs.job_id)
        WHERE sjs.subsystem = 'SSIS'
    GO
    or here is an
    article that uses PowerShell
    Andy Tauber
    Data Architect
    The Vancouver Clinic
    Website | LinkedIn
    This posting is provided "AS IS" with no warranties, and confers no rights. Please remember to click
    "Mark as Answer" and
    "Vote as Helpful" on posts that help you. This can be beneficial to other community members reading the thread.

  • Unable to Run SSIS Package Through SQL Agent Job

    Hi,
    I recently upgraded SQL server 2008 R2 to SQL Server 2012. I also upgraded all the packages on the server. The package runs fine from BIDS. However when I try to run the package through the SQL Agent Job it fails with the error below:
    Executed as user: A. Microsoft (R) SQL Server Execute Package Utility  Version 11.0.2100.60 for 64-bit  Copyright (C) Microsoft Corporation. All rights reserved.    Started:  11:43:04 PM  Could not load package "\FolderA\Package.dtsx"
    because of error 0xC00160AE.  Description: Connecting to the Integration Services service on the computer "S2345WE" failed with the following error: "Access is denied."    By default, only administrators have access to the
    Integration Services service. On Windows Vista and later, the process must be running with administrative privileges in order to connect to the Integration Services service. See the help topic for information on how to configure access to the service.  Source:
      Started:  11:43:04 PM  Finished: 11:43:04 PM  Elapsed:  0.016 seconds.  The package could not be loaded.
    Using Windows Authentication I am able to login to Integration services through SSMS. In the SQL Agent job I am using package store to execute the package. I have admin permission on the server. The integration services currently uses my credentials while
    running.I am not sure why I am getting this error.
    Please advice..
    Thanks,
    EVA05

    Hi ,
    similar thread - http://social.technet.microsoft.com/Forums/en-US/sqlintegrationservices/thread/25e22c7e-bae0-42e4-b86d-2db7a4af519d
    Try this link -
    http://msdn.microsoft.com/en-us/library/dd440760%28v=sql.100%29.aspx
    sathya --------- Please Mark as answered if my post solved your problem and Vote as helpful if my post was useful.

  • 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

  • How to pass values to SQL server Agent Job which internally calls SSIS

    Hi,
    I have a requirement where i need to call remotely SSIS package from ASPX. After following MSDN form, I have creaed one SQL server agent job and calling that job from ASPX. I am ablt call SQL server agent job from ASPX. Only issue i am facing is: I need
    to pass 2 variables from ASPX to SQL Agent job so that from Job i can map the same to SSIS Package.
    I am using system SP (sp_start_job) for calling SQL server agent job as mentioned in MSDN forum.
    below is the code , which i am using to call SQL serve agent job.
    Code:
    SqlConnection
    jobConnection;
    SqlCommand jobCommand;
    SqlParameter jobReturnValue;
    SqlParameter jobParameter;
    int jobResult;
                    jobConnection =
    new
    SqlConnection("Server=ServerName;Initial
    Catalog=msdb;Integrated Security=SSPI;user id=username;Password=password");
                    jobCommand =
    new
    SqlCommand("sp_start_job",
    jobConnection);
                    jobCommand.CommandType =
    CommandType.StoredProcedure;
                    jobReturnValue =
    new
    SqlParameter("@RETURN_VALUE",
    SqlDbType.Int);
                    jobReturnValue.Direction =
    ParameterDirection.ReturnValue;
                    jobCommand.Parameters.Add(jobReturnValue);
                    jobParameter =
    new
    SqlParameter("@job_name",
    SqlDbType.VarChar);
                    jobParameter.Direction =
    ParameterDirection.Input;
                    jobCommand.Parameters.Add(jobParameter);
                    jobParameter.Value =
    "ImportCMTData";
                    jobConnection.Open();
                    jobCommand.ExecuteNonQuery();
                    jobResult = (
    Int32)jobCommand.Parameters["@RETURN_VALUE"].Value;
                    jobConnection.Close();
    switch (jobResult)
    case 0:
    Console.WriteLine("SQL
    Server Agent job, RunSISSPackage, started successfully.");
    break;
    default:
    Console.WriteLine("SQL
    Server Agent job, RunSISSPackage, failed to start.");
    break;
    Console.Read();
    Thanks
    Pankaj

    "3-4 concurrent users are calling the SSIS package from ASPX page" this is not a proper design
    If the data is being ingested than it is likely that this concurrency will lead to one of the packages die
    What you shell do is to just queue the data ingress/processing.
    In general, again, packages should not be called from ASP web pages, SSIS is ETL-server side technology there is nothing signalling back to the user whether it was successful. The proper way is to write a REST service or alike. 
    Arthur
    MyBlog
    Twitter

  • How to Run SSIS Package through SQL AGENT Job

    I am good with SSIS, I created a package which will load the excel files to SQL SERVER  tables. To Implement this I wrote the C# code to extract the first sheet name only, and then
    package will load the data present the first sheet only. The package working fine when i run this through BIDS. But the same package throwing error at C# code step when i am running this package through SQL AGENT JOB. When i searched for this, i have seen
    many posts saying that, this is happening becoz of using Microsoft.interop.excel references inside the c# code. Please help me with this. Is there any alternate way in c# to extract the first sheet name(not based on ascending order) of an excel file with out
    using interop. Or
    How to configure SQL AGENT job to run suceessfully when using interop inside the code.
    My UAT server is of 64 bit. And i have to run this in the same server.
    I tried creating  "Desktop" folder in "C:\Windows\System32\config\systemprofile\"
    Error:Description: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object.     at ST_ecfa668f250a45e18c95639c9ffd64d4.csproj.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()  End Error  Error: 2015-02-27 11:24:00.23     Code: 0x00000001
        Source: User Mail      Description: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Data.SqlClient.SqlException: A network-related or instance-specific error
    occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could
    not open a connection to SQL Server)     at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)     at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
        at System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject)
        at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject)     at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String
    host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart)     at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString
    connectionOptions, String newPassword, Boolean redirectedUserInstance)     at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword,
    SqlConnection owningObject, Boolean redirectedUserInstance)     at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection)  
      at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options)     at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owning...
     The package execution fa...  The step failed
    using System;
    using System.Data;
    using System.Diagnostics;
    using Microsoft.SqlServer.Dts.Runtime;
    using System.Windows.Forms;
    using System.Data.OleDb;
    using Microsoft.Office.Interop;
    using System.Runtime.InteropServices;
    namespace ST_ecfa668f250a45e18c95639c9ffd64d4.csproj
    [System.AddIn.AddIn("ScriptMain", Version = "1.0", Publisher = "", Description = "")]
    public partial class ScriptMain : Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase
    #region VSTA generated code
    enum ScriptResults
    Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success,
    Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure
    #endregion
    public void Main()
    { /*Passing the file path via User::File_Name Variable*/
    string FileName = Dts.Variables["User::File_Name"].Value.ToString();
    Microsoft.Office.Interop.Excel.Application xlApp = null;
    Microsoft.Office.Interop.Excel.Workbook excelBook = null;
    try
    xlApp = new Microsoft.Office.Interop.Excel.Application();
    excelBook = xlApp.Workbooks.Open(FileName, Type.Missing,
    Type.Missing, Type.Missing, Type.Missing,
    Type.Missing, Type.Missing, Type.Missing, Type.Missing,
    Type.Missing, Type.Missing, Type.Missing, Type.Missing,
    Type.Missing, Type.Missing);
    string[] excelSheets = new string[excelBook.Worksheets.Count];
    int i = 0;
    foreach (Microsoft.Office.Interop.Excel.Worksheet wSheet in excelBook.Worksheets)
    excelSheets[i] = wSheet.Name;
    i++;
    Dts.Variables["User::WorkSheetName"].Value = excelSheets[0] + "$";
    catch (Exception ex)
    excelBook.Close(false, FileName, null);
    Marshal.ReleaseComObject(excelBook);
    string error = ex.Message;
    finally
    excelBook.Close(false, FileName, null);
    Marshal.ReleaseComObject(excelBook);
    Dts.TaskResult = (int)ScriptResults.Success;

    I installed office in my machine...but this doesn't solved my problem...
    Finally i figured out the solution for this and it is working now, Here is the solution...!
    Create the folder with name "Desktop" inside the below mentioned path
    C:\Windows\SysWOW64\config\systemprofile\   
    But i really don't understand the logic behind this. Can someone explain it pls....

  • How can I edit the Alert Description for a SQL Agent Job monitor, specifically Job Duration.

    I'm setting up some sql agent job monitoring, I need to monitor for Job Duration. 
    This is easy enough, I just create the overrides and set the parameters and it alerts as expected, however there is no alert text. The alert does me no good with out an alert description. How can I change this?
    Paul Arbogast

    Paul
    It is not an easy way for your just copy that monitor and modify it. If you has interest, you may use MP2XMLDumper tool to export SQL server monitoring MP , modify relate moniotr and import it into SCOM.
    You can download  MP2XMLDumper tool  from
    http://blogs.technet.com/b/cliveeastwood/archive/2007/08/22/mp2xmldumper-version-2-0-export-opsmgr-mp-s-to-xml-using-mp-name-export-criteria.aspx 
    Roger

  • How to get the SQL Signon that Agent Jobs "Run As" or "Executed as User"

    How to get the SQL Signon that Agent Jobs "Run As" or "Executed as User"?
    I have an install SQL scripts that creates a Linked Server. I want to put some security on the Linked Server and only grant the Agent Job Signon (the "Run As" or "Executed as User") access to the linked server. I need to retrieve the
    Agent Job Signon (something like "NT SERVICE\SQLAgent$FIDEV360BI02").
    I could query certain jobs and SUBSTRING the Message column - using some form of the query below, which would return "Executed as user: NT SERVICE\SQLAgent$SSDEVBI02. The step succeeded." But that is pretty imprecise.
    use msdb
    SELECT [JobName] = JOB.name,
    [Step] = HIST.step_id,
    [StepName] = HIST.step_name,
    [Message] = HIST.message,
    [Status] = CASE WHEN HIST.run_status = 0 THEN 'Failed'
    WHEN HIST.run_status = 1 THEN 'Succeeded'
    WHEN HIST.run_status = 2 THEN 'Retry'
    WHEN HIST.run_status = 3 THEN 'Canceled'
    END,
    [RunDate] = HIST.run_date,
    [RunTime] = HIST.run_time,
    [Duration] = HIST.run_duration,
    [Retries] = HIST.retries_attempted
    FROM sysjobs JOB
    INNER JOIN sysjobhistory HIST ON HIST.job_id = JOB.job_id
    -- CHANGE THIS
    -- WHERE JOB.name like '%GroupMaster%' or Job.name like '%etlv%'
    ORDER BY HIST.run_date, HIST.run_time

    by default all sql jobs are executed as sql server agent account, unless otherwise a proxy is setup.
    you can get the proxy information as Olaf mentioned, if the proxy_id is null for the step, it implies that the job step was executed as sql server service account and in such case it will be null
    so, if it is null, it ran as sql server agent account.
    so, one work around is get the sql server agent service account and if the proxy is null, that means it ran as sql server agent account, so, use isnull function. the disadvantage would be if the sql server agent account was switched, you might not get the
    accurate information as the new account will show up though the job really ran as old account, to get this information, you need to  get this from the logmessage column as you mentioned above.
     try this code...
    /*from sql 2008r2 sp1, you get the service accounts using tsql,otherwise you have to query the registry keys*/
    declare @sqlserveragentaccount varchar(2000)
    select @sqlserveragentaccount= service_account
    from sys.dm_server_services
    where servicename like '%sql%server%agent%'
    select message,isnull(name,@sqlserveragentaccount) as AccountName
    from sysjobhistory a inner join sysjobsteps b
    on a.step_id=b.step_id and a.job_id=b.job_id
    left outer join sysproxies c on c.proxy_id=b.proxy_id
    Hope it Helps!!

Maybe you are looking for