Using xp_serviceControl ,
- Parameter1 excepts the following
Start
Stop
Pause
Continue
Querystats
print 'checking MSSQL service'
exec master..xp_servicecontrol 'QueryState', 'MSSQL'
print 'checking SQLAgent service'
exec master..xp_servicecontrol 'QueryState', 'SQLAgent'
print 'checking MSFTESQL service'
exec master..xp_servicecontrol 'QueryState', 'MSFTESQL'
print 'checking msdtc service'
exec xp_servicecontrol N'querystate',N'msdtc'
print 'checking Sql Browser service'
exec xp_servicecontrol N'querystate',N'sqlBrowser'
This function can be easily used to start ,stop ,pause and check the status of different services in Sql Server.
Enjoy
Comments
Post a Comment