Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Retrieving Records by Date alone(time excluded)
Message
From
11/08/1999 17:19:03
 
 
To
11/08/1999 14:46:24
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
00251925
Message ID:
00252747
Views:
7
I can think of two approaches:

SELECT *
FROM table
WHERE DATEPART(yy, datetimecolumn) = DATEPART(yy, datetimeconstant)
AND DATEPART(dy, datetimecolumn) = DATEPART(dy, datetimeconstant)

The downside with this solution is that it's not optimizable.

The other solution is to have the front-end supply the constraint in a bounded form:

SELECT *
FROM table
WHERE datetimecolumn BETWEEN '19990811 00:00:00.000' AND '19990811 23:59:59.999'

Which is optimizable but requires the front end to format the constraint propertly.

-Mike
Michael Levy
MCSD, MCDBA
ma_levy@hotmail.com
Previous
Reply
Map
View

Click here to load this message in the networking platform