reporting services - SQL Case for WHERE clause IN -


i trying pass report parameter stored procedure (@time) dictate category values returned in data set via clause , don't know syntax accomplish correctly. suspect case/if need used , i've done before not when needing clause in.

declare @time nvarchar set @time = 'reg' --possible values of 'reg' , 'ot'  select f.[category]    [category]  foo f  @time =     case @time     when 'reg' f.[category] in (a, b, c, d)     when 'ot' f.[category] in (e, f, g)  end 

first, when declare character variable, should include length. so, declaring @time 1 character. think want 3-characters.

second, when declare nvarchar() variable, assign nvarchar() it. syntax n'reg' rather 'reg'.

third, in in list? intend these constants or columns in data?

and, finally, want clause like:

where (case when @time ='reg' , f.[category] in (a, b, c, d)  'true'             when @time ='ot' f.[category] in (e, f, g) 'true'             else 'false'        end) = 'true' 

Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -