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

x
  • 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.
0
No1Coder
Asked:
No1Coder
1 Solution
 
BrandonGalderisiCommented:
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))
   raiserror('FailJob',16,1)
0
 
No1CoderAuthor Commented:
Thanks!
0

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