How to alter job execution in sql server using tsql

Posted on 2011-10-11
Last Modified: 2012-05-12
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.
Question by:No1Coder
    LVL 39

    Accepted 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))

    Author Closing Comment


    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
    Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
    In this tutorial viewers will learn how to embed custom externally-hosted Google Fonts using the Google Font API in CSS Go to the Google Fonts website at Browse or search based on font properties or name to find a suitable font for…
    The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

    733 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    24 Experts available now in Live!

    Get 1:1 Help Now