Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: SQL Server
Expertise: Beginner
Nov 20, 1998

Sort by date

Question:
In a project tracking database, one of the columns in a table contains the date in this format: MM/DD/YY. I would like to be able to see a listing of projects that are overdue. Is it possible to query the table so that the SQL statement returns only records with dates before the current date? How do I retrieve today's date?

Answer:
I'll assume that the field you are talking about is defined as a date. (If not, you will have to use either the convert function or some of the string functions with the convert to have it treated as a date). You could then simply say:

 
select * from projects
where 
projdate < getdate() 

—getdate returns today's date

DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date