Future date | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Future date

Hey,
Lets say i have a StopDate and Getdate. eg1. 07/31/2007 03/08/2007
eg2. 01/31/2007 03/08/2007 I need to find out that the Stop date is in the future and not in the past when i run the report for today Could you please let meknow how would i do this.
Thank you,
Mattie
Easy goes.. Dates are actually considered as numbers in SQL Server Declare @Stopdate datetime
set @Stopdate = ‘…some date ..’ IF @Stopdate > getdate()
BEGIN
PRINT ‘Stopdate is in the future’
END
Look up the DATEDIFF function.. It will also do the trick.. regs, Eventloop "Follow the join tree" – Dan Tow
i assume the Getdate is a column in your table ?
select *
from yourtable
where StopDate > Getdate
or if you are referring to getdate() function
select *
from yourtable
where StopDate > dateadd(day, datediff(day, 0, getdate()), 0)
KH
Thank you so much for all your help used this and it works
StopDate > dateadd(day, datediff(day, 0, getdate()), 0) Mattie
]]>