Wrox Home  
Search P2P Archive for: Go

  Return to Index  

sql_language thread: how to compare current time value with a predefined datetime value


Message #1 by Floyd Hunag <flloid@p...> on Fri, 19 Jan 2001 23:39:09 +0800
Ok 

Follow this logic

You are presumably only interested in Today

so your select Query can exclude datesearlier than Today

Thus Where Getdate() minus 1 day 

Now your example is restricted to only hour 20

SELECT DATEPART(hh,adate) as interestedhour
FROM TblSys
WHERE DATEPART(hh,adate) = '20' and adate > GetDate()-1


This works

Roland

  Return to Index