简体   繁体   中英

Multiple values in SSRS paramter search in sql

I have a SSRS report and it has parameter @area.This parameter is a multiple value parameter.

For example,in SSRS ,@area='washington,DC','Delhi' and sql query is:

Select country from geography where area in(@mma).

However, I want the result to give me all countries where area contains 'washington' and'delhi'. @mma can have any number of values during runtime.I am using R2.

My preference for this is to use dynamic sql which would look something like...

declare @sql NVARCHAR(MAX) = 'Select country from geography where area in (' + @mma + ')'
execute sp_executesql @sql

However there are other solutions such as splitting the string in the SSRS parameter or even in sql.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM