Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
780 views
in Technique[技术] by (71.8m points)

sql server 2008 r2 - Optional multi-valued parameters in SSRS

I have 3 multivalued parameters in my report.Out of them 2 are optional. Is there any way to get the results in the report with out selecting any from the 2 optional parameters.

My stored proc checks the mulivalued parameters as (States IN (SELECT * FROM Split(@State,',')))

I have done this for a single valued parameter with WHERE CustomerId = @CustId OR @CustId IS NULL.

WorkAround: I selected 'Allow null value', it is throwing this error "A multi-value parameter cannot include null values"

Can anyone point me in the right direction?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Have a look at this article on Passing Multivalued parameters.

Basically the above link contains a workaround to meet your requirement for an optional multivalued parameter. The steps to achieve this are as follows:

  1. Replace "ALL" with " " (BLANK) in the parameter's dataset query.
  2. Assign -1 as default parameter value for your multivalued parameter.

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...