• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 229
  • 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:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

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