Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Any problems using char(8) for dates in YYYMMDD
Message
General information
Forum:
Microsoft SQL Server
Category:
Database design
Miscellaneous
Thread ID:
00598911
Message ID:
00599623
Views:
16
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
Previous
Reply
Map
View

Click here to load this message in the networking platform