Code Makes Sure the SQL Agent Service Is Running

Downloads
46083.zip

Many of the programs I’ve written depend on the SQL Agent Service. To make sure that no one has configured this service to run manually (I’ve encountered many idiosyncrasies in my job), I rely on the piece of code that Listing 1 shows. This code ensures that the SQL Agent Service is running. You can also transform it into a startup procedure, as Listing 2 shows.

Editor’s Note
Share your SQL Server discoveries, comments, problems, solutions, and experiences with products and reach out to other SQL Server Magazine readers. Email your contributions (400 words or less) to [email protected] Please include your phone number. We edit submissions for style, grammar, and length. If we print your submission, you’ll get $50.

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish