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

x
?
Solved

SQL Date Comparison Issue

Posted on 2011-10-04
3
Medium Priority
?
378 Views
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.
0
Comment
Question by:jazzcatone
3 Comments
 
LVL 2

Accepted Solution

by:
penyCuicas earned 2000 total points
ID: 36911533
SELECT CASE WHEN DataValidationDue < GETDATE() THEN 'Overdue' ELSE 'Pending' END FROM YourTable
0
 
LVL 5

Expert Comment

by:bitref
ID: 36911592
I think u need the vice versa i.e.use > instead of <
0
 

Author Closing Comment

by:jazzcatone
ID: 36911704
Thanks
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Kernel Data Recovery is a renowned Data Recovery solution provider which offers wide range of softwares for both enterprise and home users with its cost-effective solutions. Let's have a quick overview of the journey and data recovery tools range he…

571 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