SQL SERVER – Stop SQL Server Immediately Using T-SQL

This question has came up many quite a few times with our development team as well as emails I have received about how to stop SQL Server immediately (due to accidentally ran t-sql, business logic or just need of to stop SQL Server using T-SQL).

Answer is very simple, run following command in SQL Editor.

SHUTDOWN

If you want to shutdown the system without performing checkpoints in every database and without attempting to terminate all user processes use following command.

SHUTDOWN WITH NOWAIT

Server can be turned off using windows services as well. SHUTDOWN permissions are assigned to members of the sysadmin and serveradmin fixed server roles.

Reference : Pinal Dave (https://blog.sqlauthority.com) , BOL

Solarwinds
Previous Post
SQL SERVER – One Thing All DBA Must Know
Next Post
SQL SERVER – Fix: Error 2596 The repair statement was not processed. The database cannot be in read-only mode

Related Posts

7 Comments. Leave new

  • Praveen Barath
    August 6, 2007 12:24 am

    What will be the IMPACT if i will directly stop the services …i mean to say ..just wana know the diffrnce !

    Reply
  • Praveen Barath
    August 6, 2007 12:27 am

    Can also by running net stop mssqlserver from a command prompt for a default instance, or by running net stop mssql$instancename from a command prompt for a named instance.

    Cheers
    Praveen

    Reply
  • Oh, and did not know about it. Thanks for the information …

    Reply
  • how to stop sql server from T-SQl server 2000

    Reply
  • but this command cant work with a stored procedure/Trigger

    Reply
  • Also keep in mind what is stated in BOL

    SHUTDOWN permissions are assigned to members of the sysadmin and serveradmin fixed server roles, and they are not transferable.

    Reply
  • after runnig this script…had to restart my system to reconnect…why so ??
    Also some settings got automatically reset to default…

    Reply

Leave a Reply

Menu