Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Query All Odd Days in a DateTime Field
Message
From
25/01/2009 10:20:23
 
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Environment versions
SQL Server:
SQL Server 2005
Miscellaneous
Thread ID:
01376540
Message ID:
01376858
Views:
10
>>>select case when DAY(EventTime)%2 =0 then 1 else 0 end as Even from CommunicationLog
>>
>>Interesting, I tried using DAY() and it returned an error that it couldn't be used....which is why I posted.
>
>Strange, worked for me in SQL 2008
>
>select * from CommunicationLog where DAY(EventTime)%2 =0
>
>where did you try this type of query?

This works for me now, but when I tried it previously it kept returning an error (can't recall the exact wording) that the day() function couldn't be used in that manner. I'm using SQL 2005 and our queries have to run against versions going back to 2000. I don't get it. I must've had a typo or something....
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform