Subject | RE: Datatypes are not comparable in expression CASE when using TIMESTAMPS |
---|---|
Author | Maya Opperman |
Post date | 2013-08-08T13:51:38Z |
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
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