|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Tuesday, April 16, 2013 5:57 AM
Points: 12,
Visits: 35
|
|
|
|
|
|
Mr or Mrs. 500
      
Group: General Forum Members
Last Login: Monday, March 04, 2013 4:10 AM
Points: 532,
Visits: 281
|
|
Maybe the question should have had the "on all SQL versions except EXPRESS" in there...
If you call xp_servicecontrol on EXPRESS edition and get an error, that is NOT telling you if the agent is running or not, it is simply returning an error...
Just my two penn'orth...
Kelsey Thornton MBCS CITP
|
|
|
|
|
SSC-Addicted
      
Group: General Forum Members
Last Login: Tuesday, December 04, 2012 11:16 AM
Points: 477,
Visits: 389
|
|
Now let's see ... I choose the first option that seems to be the only option that works for me, then I am plainly told that another option (that indeed WON'T work for me with SQLExpress) MUST be chosen, even though it's admitted that it won't work, in order to get a correct answer! Come on now; please get these question-setters showing self-consistency or setting some bounds/conditions that need to be met. Why don't I set some questions then? Mainly 'cos I'm not a DBA; I use this forum to learn stuff. "What's 1 + 1?" "2" "Wrong! It's 10. I was talking binary/base 2. Didn't you know that?"
|
|
|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Tuesday, April 16, 2013 5:57 AM
Points: 12,
Visits: 35
|
|
On using " xp_servicecontrol querystate, SQLSERVERAGENT " the error shown is "OpenService() returned error 1060, 'The specified service does not exist as an installed service.'" Doesn't this error mean that the agent is not installed, and hence not running? This is also a way to find out if the agent is running.
|
|
|
|
|
Mr or Mrs. 500
      
Group: General Forum Members
Last Login: Monday, March 04, 2013 4:10 AM
Points: 532,
Visits: 281
|
|
sorry - I obviously missed that all-important comma in the question (and in the given "correct" answer) ;)
Kelsey Thornton MBCS CITP
|
|
|
|
|
SSCommitted
      
Group: General Forum Members
Last Login: Yesterday @ 6:17 AM
Points: 1,625,
Visits: 1,926
|
|
Although most of us are guilty of using undocumented procedures, we really shouldn't promote the use of them.I spent a lot of time cleaning up a boat load of code that used undocumented stuff so we could move apps to 2005.
MG
"There are two ways of constructing a software design. One way is to make it so simple that there are obviously no deficiencies. And the other way is to make it so complicated that there are no obvious deficiencies." Tony Hoare
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair.
|
|
|
|
|
SSChampion
        
Group: General Forum Members
Last Login: Today @ 3:41 AM
Points: 13,383,
Visits: 25,189
|
|
|
|
|
|
SSC Veteran
      
Group: General Forum Members
Last Login: Thursday, June 26, 2008 7:27 AM
Points: 239,
Visits: 165
|
|
I am not familiar with the xp_servicecontrol querystate option and cannot find any documentation on its use. In addition this option has a caveat to it. It works but not always. I believe that the answer is just to query sysprocesses for the sqlAgent and forget about undocumented procedures. Some of these undocumented procedures may have undocumented affects. I am with MG on this, I don't think we should encourage their use, but if you do want to use them, remember the explanation to this QOTD. It works except...!:)
Q
Please take a number. Now serving emergency 1,203,894
|
|
|
|
|
SSCoach
         
Group: General Forum Members
Last Login: Tuesday, May 21, 2013 1:55 PM
Points: 15,442,
Visits: 9,571
|
|
I have to say that the question and answer seem good to me. I would never have thought of even trying to do this (find out if SQL Server Agent is running with T-SQL), but I can see where it could matter for certain programs.
I had to search for data on these and find the context on them.
I think this one was good.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
|
|
|
|
|
Hall of Fame
       
Group: General Forum Members
Last Login: Today @ 3:49 AM
Points: 3,231,
Visits: 64,347
|
|
|
|
|