Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Date Format
Message
De
30/04/2003 12:19:11
 
 
À
30/04/2003 10:58:55
Alvin Lourdes
Children and Youth Services Cluster
Toronto, Ontario, Canada
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Titre:
Divers
Thread ID:
00783178
Message ID:
00783228
Vues:
18
>I would like to return only the full date portion of this field.

SQL Server only has a datetime datatype. You will always have a time componenet.

DECLARE @d datetime
SET @d = '20030429'
SELECT @d

You see that the time component is set to 12:00am

>When I perform a search on this field... if I look for 04/11/2003 will I get the appropriate row?

Since there is only a date, SQL Server will default the time component to 12:00am. The only rows that will be matched are those who's value is set to 4/11/2003 12:00am.

I perfer to use the following when searching on dates:

datetimecolumn >= '20030411' and datetimecolumn < '20030412'

-Mike
Michael Levy
MCSD, MCDBA
ma_levy@hotmail.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform