For more tips like this, LIVE and IN PERSON, come see us at the MSDN Roadshow !
Many times you’ll be working with a SQL Server database when you are writing ASP.NET code. There will be times (often for me) where you will need to stop or jump your server. Here are some reasons why you’d want to do this, and a tip to show you how to do it really quickly. This is great for people who hate using the mouse.
Why should I stop SQL Server in the middle of programming?
The number one reason is for when you are performing a backup. I back up almost every day. You’ll need to stop the SQL Server service in order to do so.
Why should I jump SQL Server in the middle of programming?
You may need to jump it because you wrote some leaky code (not going to incriminate myself) and want to refresh your connections and freshen up your memory allocation. Open up your Task Manager from time to time to check how your memory is doing with SQL Server. Sometimes a quick jump as you are debugging a tricky problem, helps speed things along.
How do I quick start SQL Server?
One of the fastest ways I find to stop SQL Server from running is with a quick volley of keystrokes (rather than going into SQL Server Management Studio or into Windows Services). You can also toss this into Notepad and run it as a batch file instead.
- Hit Windows key + R. This will pop-up the Run dialog box
- Type in net stop mssqlserver
- When you are ready to start the service again, type net start mssqlserver
Both steps will cause a command window to open indicating progress.
For Vista users you can also use accelerator keys if you do not have a Windows key on your keyboard. Replace step 1 with:
- Hit CTRL+ESC or the Windows key
- Type R – this will bring up the Run command
Where is my Run dialog box?
For those of you running Windows7, the Run command isn’t available from your Start menu by default. You can turn it on:
- Right click on your Start icon (that’s the Windows Logo in the bottom left corner of your screen)
- Select Properties
- Chose the Start Menu tab
- Click the Customize button
- Scroll down until you see the “Run command” check box.
- Check it.
- Click Ok.