Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Date question
Message
From
27/08/1999 17:09:47
 
 
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Title:
Miscellaneous
Thread ID:
00257848
Message ID:
00258671
Views:
16
Geez ... and people really put up with this huh?

I thjink I'll just try to make sure everything is input as jsut the date part of the expression so it goes to 12:00AM. What's the best way to get the "date part" of a GetTime() value?

thanks for your help!
Ken

>Ken,
>
>You have two options. First you can use the between:
>
>orderdate BETWEEN '19990501' AND '19990501 23:59:59:999'
>
>Your other option is to use the DATEPART() function and apart the date into day-of-year and year:
>
>DATEPART(yy, orderdate) = DATEPART(yy, '19990501) AND
>DATEPART(dy, orderdate) = DATEPART(dy, '19990501)
>
>The downside is that SQL Server won't be able to optimize the expression.
>
>-Mike
>
>
>>Hi all,
>>
>>How does one get the 'date" from a SQL server "DateTime" expression. If the answer is "you don't", then how does one go about doing date comparisons in searches?
>>
>>For example ... if I have a field called "OrderDate" that is filled with GetDate(), it is going to have something like "05/01/99 10:24:36:345 AM" stored in it. Now, how can I construct my where clause to find all records with an order date of "05/01/99" ? Obviously a search for "OrderDate = "05/01/99" wouldn't work because of the time portion of the value.
>>
>>Thanks!
>>Ken
Ken B. Matson
GCom2 Solutions
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform