Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Querying Dates
Message
De
12/07/2007 16:35:20
 
 
À
12/07/2007 16:27:05
Mike Cole
Yellow Lab Technologies
Stanley, Iowa, États-Unis
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Autre
Titre:
Versions des environnements
SQL Server:
SQL Server 2000
Divers
Thread ID:
01239895
Message ID:
01239907
Vues:
16
Yea. When I posted this I thought there might be a 2005 solution, but I didn't want to limit myself cuz I have too many clients who are on 2000.

Thanks. Any other ideas are greatly appreciated. My question is, how efficient is the CONVERT() function, i.e., will the result be slowed if there are 10,000s of records?

bob

>>We have a number of queries we write that look only at the date portion of a datetime field. I was wondering if anyone has an efficient way of looking at just the date. For example
>>
>>SELECT * from MyTable WHERE date = '01/01/2007'
>>
>>With the above query the following would be selected
>>
>>DATE = 01-01-2007 00:00:00
>>
>>And the following would not:
>>
>>DATE = 01-01-2007 01:30:50
>>
>>or,
>>
>>SELECT * from MyTable WHERE date BETWEEN '01/01/2007' AND '01/02/2007'
>>
>>With the above query the following would be selected
>>
>>DATE = 01-02-2007 00:00:00
>>
>>And the following would not:
>>
>>DATE = 01-02-2007 01:30:50
>>
>>
>>Thanks.
>>
>>Bob Bartel
>
>Not pretty, but here:
>
>
>SELECT *
>FROM MyTable
>WHERE DueDate = CONVERT(DATETIME, FLOOR(CONVERT(FLOAT, '1/1/2007')))
>
>
>I read there was function in 2005 to specifically handle this, but this is how I do it in 2000.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform