i want select either week days or full week depending on parameter.
i looking @ using case statement following, don't know how convert string of number value can passed integers.
im doing wrong appreciated.
this im setting param value:
set @days = (select case when fullweek = 1 cast('1,2,3,4,5,6,7' numeric(38,0)) when fullweek = 0 cast('2, 3,4,5,6' numeric(38,0)) end reports)
and how want call this, part of statement:
where datepart(dw,date) in (@days)
why not simplify , way:
where (fullweek = 1) -- days of week or (fullweek = 0 , datepart(dw,date) in (2,3,4,5,6))
Comments
Post a Comment