>I managed to get around it as follows, but I'd say it is a bug: > >What I wanted to do: > >case > when ((p.StartDate <= cast('Today' as date)) and (p.EndDate >= > cast('Today' as date))) then > (cast('Today' as date) + 1) > else > p.enddate + 1 > end > >What I ended up doing to get around the problem: > >case > when ((p.StartDate <= cast('Today' as date)) and (p.EndDate >= > cast('Today' as date))) then > (cast('Today' as date) + 1) > --else problem with dates and else section > when (p.StartDate > cast('Today' as date)) then > p.enddate + 1 > when (p.EndDate < cast('Today' as date)) then > p.enddate + 1 > end
Sorry, should have sadi p.enddate is a timestamp Set Wrote: >What surprises me more is that your first query fails, whereas the second >succeeds. Yeah, I'd expect the behaviour to be the same (either work, or give an error) whether I put the timestamp field in the "else" section or not.