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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Just get the time from date time field

Author  Topic 

jmpierce30
Starting Member

7 Posts

Posted - 2009-04-21 : 14:33:38
We are using Microsoft dynamics NAV which is storing time in a SQL Table as 1754-01-01 XX:XX:XX the x's being the time, and the other is i'm assuming the default date. I need to filter just the time portion, to see if something happened between 9:00 AM and 10:00 AM Any easy way to do this?

Thanks for your help

while (I != Understand)
{
KickMe.Hard;
}

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2009-04-21 : 14:50:33
If this WHERE clause is applied to a sql SELECT statement then the results will include ANY Date values where the time is between 9:00 am and 10::00 am

where datepart(hour, <datetimeColumn>) between 9 and 10

Be One with the Optimizer
TG
Go to Top of Page
   

- Advertisement -