How can I tell if a service is running from SQL?

Neil Pike

October 20, 1999

1 Min Read
ITPro Today logo

A. A couple of methods :-

1. Write your own XP to call the NT service API's.

2. Capture and test the NET START output via xp_cmdshell. Example below tests for SQL Agent -

CREATE TABLE #List(Description Char(255))

INSERT INTO #List
EXEC XP_CMDSHELL 'NET START'

IF EXISTS
(SELECT * FROM #List WHERE Description LIKE '%SQLServerAgent%')

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like