Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 222
  • Last Modified:

How to alter job execution in sql server using tsql

I want to alter the execution (pass/fail) of a job based on tsql results.  Very simply, I want to create a job that will fail, and send a notification message, if a date in a table is not = to today.

I can create a stored procedure, but how to maje job fail based on results?

BTW:  I am using SQL Server 2005 Workgroup.
1 Solution
Create a job that executes TSQL like so.  It will fail if the date is not = today.

If not exists (select 1 from dbo.SomeTable where SomeDate = dateadd(d, datediff(d, 0, getdate()),0))
No1CoderAuthor Commented:

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now