Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the best way to start and stop SQL Server from the command line?

I need to start and stop SQL Server from the command line. I am willing to write a small C# program if necessary, but I suspect that there's something (PowerShell, maybe?) that currently exists that does this gracefully.

Thank you

like image 720
rp. Avatar asked Dec 15 '08 15:12

rp.


People also ask

How do I start SQL Server from command line?

Open a Command Prompt window, and type sqlcmd -SmyServer\instanceName. Replace myServer\instanceName with the name of the computer and the instance of SQL Server that you want to connect to. Press ENTER. The sqlcmd prompt (1>) indicates that you are connected to the specified instance of SQL Server.

What is the recommended start up mode for SQL Server?

If you start an instance of SQL Server with -n, we recommend that you also use the -e startup option. Otherwise, SQL Server events are not logged. Allows you to start a named instance of SQL Server. Without the -s parameter set, the default instance will try to start.


1 Answers

net {start|stop} mssqlserver

like image 173
P Daddy Avatar answered Sep 21 '22 18:09

P Daddy