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 (http://blog.SQLAuthority.com) , BOL

About these ads

8 thoughts on “SQL SERVER – Stop SQL Server Immediately Using T-SQL

  1. 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

    Like

  2. Pingback: SQL SERVER – Weekly Series – Memory Lane – #041 | Journey to SQL Authority with Pinal Dave

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s