SQL Server Performance Forum – Threads Archive
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.
Easy goes.. Dates are actually considered as numbers in SQL Server Declare @Stopdate datetime
set @Stopdate = ‘…some date ..’ IF @Stopdate > getdate()
PRINT ‘Stopdate is in the future’
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 ?
where StopDate > Getdate
or if you are referring to getdate() function
where StopDate > dateadd(day, datediff(day, 0, getdate()), 0)
Thank you so much for all your help used this and it works
StopDate > dateadd(day, datediff(day, 0, getdate()), 0) Mattie