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

SQL Scripts
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

Leave a Reply