Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Easy One
Message
Information générale
Forum:
ASP.NET
Catégorie:
Bases de données
Titre:
Divers
Thread ID:
00864178
Message ID:
00864284
Vues:
14
>> end_time between '01/05/04' and '01/06/04'

Becareful with the use of BETWEEN. It's inclusive. In this case, you could pick up rows that were created 6 Jan 2004 12:00am. To capture rows for a single day, I perfer:

end_time >= '20040105' and end_time < '20040106'

-Mike

>Below is a SQL statement I am running. The query returns 0 records, but it should return 1 record. The problem is with the end_time portion of the where clause, though I don't know how to fix it.
>
>Please help
>
>
>SELECT dc_id, taskdtl_id, userid, start_time, end_time, total_time,
> billable, opcode_id
>FROM data_collection
>WHERE taskdtl_id = 240
>and userid = 1
>and end_time = 01/05/04

>
>In SQL Server there is no such thing as a "Date" Type Field - only "DateTime" so what's happening here is that 01/05/04 is being transalated 01/05/04 12:00:00 AM
>
>If you're looking for a record for a particular date you may want to use ...end_time > '01/05/04' or ...end_time between '01/05/04' and '01/06/04'
Michael Levy
MCSD, MCDBA
ma_levy@hotmail.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform