Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Any problems using char(8) for dates in YYYMMDD
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Conception bases de données
Divers
Thread ID:
00598911
Message ID:
00599623
Vues:
17
IMO, I don't see any reason for the extra work nor extra storage that the additional column will require.

When the user enters two dates, SQL Server will assume that the time component is midnight (00:00:00). Instead of using BETWEEN in your queries:

WHERE datetimecol BETWEEN startdatetime AND stopdatetime

Try something like this:

WHERE (datetimecol >= startdatetime AND datetimecol < stopdatetime+1)

Pushing the ending date constraint to midnight of the next day allows the query to capture all the rows that occur on the ending day.

-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