Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Date question
Message
De
28/09/1999 10:58:08
 
 
À
20/09/1999 22:34:44
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Titre:
Divers
Thread ID:
00257848
Message ID:
00269939
Vues:
22
>>Hi all,
>>
>>How does one get the 'date" from a SQL server "DateTime" expression. If the answer is "you don't", then how does one go about doing date comparisons in searches?
>>
>>For example ... if I have a field called "OrderDate" that is filled with GetDate(), it is going to have something like "05/01/99 10:24:36:345 AM" stored in it. Now, how can I construct my where clause to find all records with an order date of "05/01/99" ? Obviously a search for "OrderDate = "05/01/99" wouldn't work because of the time portion of the value.
>>
>>Thanks!
>>Ken
>
>This may be a little late and I don't know how far you've gone but this is what I do:
>
>SELECT * FROM AFile where OrderDATE >= "05/01/1999 00:00:00" and _
>OrderDate <= "05/01/1999 23:59:59"
>
>Hope this helps...
>
>Ramon Carlos
Depending on how large the file is...

SELECT * FROM AFile where CONVERT(char(10),OrderDATE) = "05/01/1999"
I usually don't like to use functions in select statements, but on smaller tables this will work fine.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform