Conditional Alerting

Dave Mason revs up SQL Server alerts using tokens and conditional responses:

There are three tokens within the T-SQL (highlighted in yellow above): A-MSG, DATE, and TIME. SQL server replaces these three tokens as follows:

 

  • A-MSG: Message text. If the job is run by an alert, the message text value automatically replaces this token in the job step.
  • DATE: Current date (in YYYYMMDD format).
  • TIME: Current time (in HHMMSS format).

See the MSDN documentation for a list of tokens and their descriptions.

 

This is a great way of being smarter with alerts.  Your SQL Server instance has a lot of information at the ready, so get familiar with what’s up for offer.

Related Posts

Initial Thoughts On dbachecks

Jess Pomfret has an initial use case for dbachecks: Each check has one unique tag which basically names the check and then a number of other tags that can also be used to call a collection of checks. For this example we are going to use several checks to ensure that we meet the following […]

Read More

Introducing dbachecks

Chrissy LeMaire announces that the dbatools team is onto something big: dbachecks is a framework created by and for SQL Server pros who need to validate their environments. Basically, we all share similar checklists and mostly just the server names and RPO/RTO/etc change. This module allows us to crowdsource our checklists using Pester tests. Such checks include: […]

Read More

Categories

April 2016
MTWTFSS
« Mar May »
 123
45678910
11121314151617
18192021222324
252627282930