Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
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.
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
madhivanan
Premature Yak Congratulator
22864 Posts
Posted - 2006-07-26 : 10:22:37
Where datecol<DateAdd(day,Datediff(day,0,getdate()),0)MadhivananFailing to plan is Planning to fail