• Eugene Elutin (3/20/2013)


    SQLCrazyCertified (3/20/2013)


    Eugene Elutin (3/20/2013)


    Not really good idea to do so, but if you really need it, use xp_cmdshell.

    xp_cmdshell 'c:\MyBatch.bat'

    Thanks Eugene, what you mean by not really good idea?....what are the alternatives, if there is any? Please advise if you don't mind.

    Thanks,

    SueTons.

    Why do you want to run batch file from within SQL Server procedure?

    What this batch is going to do?

    There is a great alternative: don't do it from sql.

    Well, this SP should be pulling the job tables every 5 min or so and seeing if any are running longer than defined SLA for that job, so, if the SP finds that any job is running longer than its defined SLA, it should trigger the .bat job and .bat job will create an automated ticket using our monitoring tool. Let me know if you have a better idea.

    SueTons.

    Regards,
    SQLisAwe5oMe.