How to start/stop local SQL Server service directly from Visual Studio?

后端 未结 2 1832
梦如初夏
梦如初夏 2021-01-24 10:28

I believe like many developers I have both Visual Studio and SQL Server installed on my PC. Since I use the PC for various tasks not just for development, SQL Server is by defau

相关标签:
2条回答
  • 2021-01-24 11:27
    1. In Visual Studio, go to Tools -> External Tools...

    2. Click the add button, and enter Start SQL Server for the title and for the command put:

      C:\WINDOWS\system32\net.exe

    3. For the arguments, put:

      start mssqlserver

    4. Untick "Close on exit" and tick "Use output window".

    5. Repeat steps 2-4 to create the stop command, but for the arguments put:

      stop mssqlserver

    You know have two external tools configured which you can run by selecting them from the Tools menu in Visual Studio.

    You can also add a shortcut button in any toolbar by right-cliking on the toolbar area, selecting customise, and then dragging the relevant external tool link (unfortunately VS refers to them as this, so you will have to figure out which one to choose) to a toolbar.

    0 讨论(0)
  • 2021-01-24 11:27

    You should just simply go to the Services Manager, however to get there from VS 2008:

    1. Go to Server Explorer Tab
    2. Expand out the Servers section
    3. Expand out the name of your computer
    4. Right click on the Services section and select Launch Services Manager
    5. From Services Manager, select SQL Server and do whatever Start, Stop, Restart action you wish to achieve

    Another way would be the commaind line approach of:

    net stop "SQL Server (MSSQLSERVER)" net start "SQL Server (MSSQLSERVER)"

    0 讨论(0)
提交回复
热议问题