Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Locating records with a specific time
Message
De
20/11/2014 07:20:33
 
 
À
19/11/2014 22:23:56
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Versions des environnements
SQL Server:
SQL Server 2012
Application:
Web
Divers
Thread ID:
01611170
Message ID:
01611222
Vues:
36
>>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.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform