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
 Filtering on smalldatetime field but not on time

Author  Topic 

meef
Posting Yak Master

113 Posts

Posted - 2015-01-23 : 13:22:55
I have a field that is stored as a smalldatetime but I want to filter on that field only for the date. How do I ignore the time stamp and only go by the date?

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2015-01-23 : 13:31:14
You can use this: DATEADD(dd, DATEDIFF(dd, 0, yourcolumngoeshere), 0)

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

meef
Posting Yak Master

113 Posts

Posted - 2015-01-23 : 14:00:28
Thanks, that did the trick.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2015-01-23 : 14:02:36
You're welcome, glad to help.

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page
   

- Advertisement -