I want to run a batch file from query window or from Trigger.

  • Why this package is not showing in File system in ssms(Integartion services).

    Thanks

  • Have you deployed that package ? Have installed two instances of sql server one sql 2005 and other sql 2008 ?

  • I want to add this package in a job.

    How can I do this...

    Thanks

  • Follow the steps to add job:

    1. Right click on jobs in SQL server agent and select "new job".

    2.Fill in a name for the job and click "Steps" at the left side of the window.

    3. Click on new to add a new step.

    4. Fill in a name for the Step. Select "SQL Server Integration Services Package" as type. Select Package Source as "SQL Server" or "File System" on the basis of where you have saved the SSIS package. Then browse and select your package.

    5. Click Advanced to select other advanced step properties. At the end of it click Ok in the Step window.

    6. Finally, click Ok in the Job window.

    After this you can create the trigger as follows:

    CREATE TRIGGER <TriggerName>

    ON <TableName>

    AFTER INSERT, UPDATE, DELETE

    AS

    EXEC msdb..sp_start_job

    @job_name = '<JobName>';

    GO

    Write the name of job in place of job name.

    Vinu Vijayan

    For better and faster solutions please check..."How to post data/code on a forum to get the best help" - Jeff Moden[/url] 😉

  • Edit: All this has to be done by connecting to the database and not to Integration Services in the connection window.

    Vinu Vijayan

    For better and faster solutions please check..."How to post data/code on a forum to get the best help" - Jeff Moden[/url] 😉

  • The package is not visble when connecting using the database engine.

    Thanks

  • Is the package visible when you explore the location(where the package is saved) using Explorer??....If its visible then it should be showing in SSMS as well.

    Vinu Vijayan

    For better and faster solutions please check..."How to post data/code on a forum to get the best help" - Jeff Moden[/url] 😉

  • It is saved in file system.

    Ok leave it.

    My main issue is "to run a batch file from trigger" any solution is there?

    Thanks

  • forsqlserver (4/16/2012)


    It is saved in file system.

    Ok leave it.

    My main issue is "to run a batch file from trigger" any solution is there?

    You have been shown how to run the SSIS package as a job from a trigger.

  • From which Explorer ??

    Is the package visible when you explore the location(where the package is saved) using Explorer??

    Thanks

  • Windows Explorer....Can you see it at the location where you saved it?

    Vinu Vijayan

    For better and faster solutions please check..."How to post data/code on a forum to get the best help" - Jeff Moden[/url] 😉

  • Yes I am able to see it in windows explorer

    Thanks

  • If you can see the job using Windows Explorer then do the following to create a job and run it as a part of the trigger. I just tried this before I posted this, its working perfectly for me.

    --Connect to Database Engine

    1. Open SSMS.

    2. Select "Database Engine".

    3. Enter your Login credentials and select to your Server.(Make sure to choose a login with maximum rights to avoid any other problems.)

    4. Start "SQL Server Agent".

    --Follow the steps to add job

    1. Right click on jobs in SQL server agent and select "new job".

    2.Fill in a name for the job and click "Steps" at the left side of the window.

    3. Click on new to add a new step.

    4. Fill in a name for the Step. Select "SQL Server Integration Services Package" as type. Select Package Source as "SQL Server" or "File System" on the basis of where you have saved the SSIS package. Then browse and select your package.

    5. Click Advanced to select other advanced step properties. At the end of it click Ok in the Step window.

    6. Finally, click Ok in the Job window.

    --After this you can create the trigger

    CREATE TRIGGER <TriggerName>

    ON <TableName>

    AFTER INSERT, UPDATE, DELETE

    AS

    EXEC msdb..sp_start_job

    @job_name = '<JobName>';

    GO

    Write the name of job in place of job name.

    Vinu Vijayan

    For better and faster solutions please check..."How to post data/code on a forum to get the best help" - Jeff Moden[/url] 😉

  • You're Welcome. I'm glad I could help.

    Vinu Vijayan

    For better and faster solutions please check..."How to post data/code on a forum to get the best help" - Jeff Moden[/url] 😉

Viewing 15 posts - 16 through 29 (of 29 total)

You must be logged in to reply to this topic. Login to reply