Making sure Windows doesn't start your service before SQL Server

Setting service dependencies via the command line

This is more of a "note to self" of the syntax, but, if you have a service that depends on another (such as a local SQL Server instance for local logging) then you can tell Windows about that dependency. The command line is:

sc config MyServiceName depend= MSSQLSERVER


  1. Needs to be run from an administrative command prompt
  2. Must have the space after the equals symbol
  3. Uses the service names that are displayed under "Service name:" at the top of the "General" tab if you view the properties of the service in the Services control panel

The name of the SQL Server service can, and will, vary. If you had an instance called BADGER then the name of the service will likely be MSSQL$BADGER, so don't assume the name of the SQL Server service. You can also use this to setup dependencies between any other services you want, it's not limited to SQL Server as it's a piece of general Windows functionality rather than being part of SQL Server.

About Rob

I've been interested in computing since the day my Dad purchased his first business PC (an Amstrad PC 1640 for anyone interested) which introduced me to MS-DOS batch programming and BASIC.

My skillset has matured somewhat since then, which you'll probably see from the posts here. You can read a bit more about me on the about page of the site, or check out some of the other posts on my areas of interest.

No Comments

Add a Comment