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
 getting date only in SQL

Author  Topic 

misterjp
Starting Member

4 Posts

Posted - 2011-03-27 : 21:32:14
Hello,

I am trying to write a query which will return results where date = today's date.

If I use getdate(), it will return nothing as getdate() includes time as well. After looking on the internet, I have tried curdate(), current_date and neither of these work.

Help!

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2011-03-27 : 21:36:49
[code]
where datecol = dateadd(day, datediff(day, 0, getdate()), 0)
[/code]


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -