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
7 Comments. Leave new
What will be the IMPACT if i will directly stop the services …i mean to say ..just wana know the diffrnce !
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
Oh, and did not know about it. Thanks for the information …
how to stop sql server from T-SQl server 2000
but this command cant work with a stored procedure/Trigger
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.
after runnig this script…had to restart my system to reconnect…why so ??
Also some settings got automatically reset to default…