sys.dm_server_services (Transact-SQL)

Returns information about the SQL Server and SQL Server Agent services in the current instance of SQL Server. Use this dynamic management view in SQL Server 2008 R2 SP1 and later versions to report status information about these services.

Column name

Data type

Description

servicename

nvarchar(256)

Name of the SQL Server service or SQL Server Agent service. Cannot be null.

startup_type

int

Indicates the start mode of the service.

ValueDescription
0Other
1Other
2Automatic
3Manual
4Disabled

Is nullable.

startup_desc

nvarchar(256)

Describes the start mode of the service.

ValueDescription
OtherOther (boot start)
OtherOther (system start)
AutomaticAuto start
ManualDemand start
DisabledDisabled

Cannot be null.

status

int

Indicates the current status of the service.

ValueDescription
1Stopped
2Other (start pending)
3Other (stop pending)
4Running
5Other (continue pending)
6Other (pause pending)
7Paused

Is nullable.

status_desc

nvarchar(256)

Describes the current status of the service.

ValueDescription
StoppedThe service is stopped.
Other(start operation pending)The service is in the process of starting.
Other (stop operation pending)The service is in the process of stopping.
RunningThe service is running.
Other (continue operations pending)The service is in a pending state.
Other (pause pending)The service is in the process of pausing.
PausedThe service is paused.

Cannot be null.

process_id

int

The process ID of the service. Cannot be null.

last_startup_time

datetimeoffset(7)

The date and time the service was last started. Is nullable.

service_account

nvarchar(256)

The account authorized to control the service. This account can start or stop the service, or modify service properties. Cannot be null.

filename

nvarchar(256)

The path and filename of the service executable. Cannot be null.

is_clustered

nvarchar(1)

Indicates whether the service is installed as a resource of a clustered server. Cannot be null.

cluster_nodename

nvarchar(256)

The name of the cluster node on which the service is installed. Is nullable.

Security

Permissions

Requires VIEW SERVER STATE permission on the server.