Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Locating records with a specific time
Message
From
20/11/2014 07:20:33
 
 
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Environment versions
SQL Server:
SQL Server 2012
Application:
Web
Miscellaneous
Thread ID:
01611170
Message ID:
01611222
Views:
37
>>What would be the TSQL syntax that would extract rows where the adddate (a datetime column) was later than 2PM on 11/18/2014?
>
>OK, there are several ways so I'm sure others might reply as well, but here's one way:
>
>I did this for a test row where getdate() returned 11/19 at about 10:20 PM. So my check below is based on 11-19 at 10:00 PM or greater.
>
>
>
>
>CREATE TABLE TestDateTime  ( TestDateTime datetime)
>
>insert into TestDateTime values ( getdate()  )
>
>select * from testdatetime where TestDateTime >= cast('2014-11-19 22:00:00' as datetime)  -- 1 row
>select * from testdatetime where TestDateTime < cast('2014-11-19 22:00:00' as datetime)  -- 0 rows
>
Thanks, Kevin
That did it.
Anyone who does not go overboard- deserves to.
Malcolm Forbes, Sr.
Previous
Reply
Map
View

Click here to load this message in the networking platform