SHUTDOWN Command

  • I'm trying to use the SHUTDOWN command from a Stored procedure, but SQL Server will not allow me to do that. However, I can run the SHUTDOWN command in a job.

    Is there a way I can call that job to run from a stored procedure or any alternative? Any help will be greatly appreciated.

  • You should be able to run the job using sp_start_job. Shutdown doesnt work in a proc (or in a transaction, according to the error message). Possibly you could use xp_cmdshell to run net stop, though you'd have to pipe in the 'Y' to it.

    Can I ask why you're doing this?

    Andy

    http://www.sqlservercentral.com/columnists/awarren/

  • Agree, seems like shooting oneself in the foot. What about the AT command? Can access it through xp_cmdshell.

Viewing 3 posts - 1 through 3 (of 3 total)

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