SQL Date Comparison Issue

Posted on 2011-10-04
Last Modified: 2012-05-12
I have a date field in my database table called "DataValidationDue" . If the value in this table is past todays date I would like it to return a string that says "Overdue" . If the value is equal to or earlier than todays date, I would like SQL server to return a string saying "Pending" Can anyone suggest to me the correct syntax for this ? Any help would be most appreciated.
Question by:jazzcatone
    LVL 2

    Accepted Solution

    SELECT CASE WHEN DataValidationDue < GETDATE() THEN 'Overdue' ELSE 'Pending' END FROM YourTable
    LVL 5

    Expert Comment

    I think u need the vice versa i.e.use > instead of <

    Author Closing Comment


    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    ASP.NET C# delay answer writing to file 11 27
    SQL Encryption question 2 32
    SQL Schedule Job 1 12
    Explain Unit of Work pattern 2 27
    Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
    IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

    728 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

    15 Experts available now in Live!

    Get 1:1 Help Now