Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Selecting dates

Author  Topic 

antonyweldon
Starting Member

1 Post

Posted - 2006-07-25 : 05:17:45
I need to be able to select records based on dates that are before a certain date. That bit's easy, my problem is that this certain date needs to be the current date. Any body be able to help?

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-07-25 : 05:19:16
current date ? as in today ? use getdate()

getdate() will return you current date & time.

If you only interested in the date (time = 00:00:00) then use
dateadd(day, datediff(day, 0, getdate()), 0)



KH

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-07-26 : 10:22:37
Where datecol<DateAdd(day,Datediff(day,0,getdate()),0)

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -