September 1, 2011 at 9:34 am
Hi,
Could anybody please help me fix the error message? DtTemp is a smalldatetime variable.
case
when (( Datepart(month,dtTemp) > 8 ) or ((Datepart(month,dtTemp) = 8)
and (DATEPART(WEEK,DAY(dtTemp))))) then
'Sep-' + cast(right(datepart(yy,dtTemp),2) as varchar(30)) + ' to ' + 'Aug-' + right(datepart(yy,dtTemp)+1,2)
else
'Sep-' + cast(right(datepart(yy,dtTemp)-1,2) as varchar(30)) + ' to ' + 'Aug-' + right(datepart(yy,dtTemp),2)
end
I am getting the error message "An expression of non-boolean type specified in a context where a condition is expected, near ')' "
Thank you.
September 1, 2011 at 9:54 am
case
when (( Datepart(month,dtTemp) > 8 ) or ((Datepart(month,dtTemp) = 8)
and (DATEPART(WEEK,DAY(dtTemp))) = 1 )) then
'Sep-' + cast(right(datepart(yy,dtTemp),2) as varchar(30)) + ' to ' + 'Aug-' + right(datepart(yy,dtTemp)+1,2)
else
'Sep-' + cast(right(datepart(yy,dtTemp)-1,2) as varchar(30)) + ' to ' + 'Aug-' + right(datepart(yy,dtTemp),2)
end
you need to have something like what ive put in bold
September 1, 2011 at 9:59 am
Thanks a lot! It fixed the error.
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy