Wednesday, March 28, 2012

passing multi value parameter to stored procedure

I wrote a Stored Procedure spMultiValue which takes Multi Value String Parameter "Month". The stored procedure uses a function which returns a table. when I Execute the stored procedure from SQL Server 2005 with input "January,February,March" everything works fine.

In the dataset , I set command type as Text and typed the following statement.

EXEC spMultiValue " & Parameters!Month.Value &"

its not returning anything.

can anyone tell me how to pass multivalue parameter to stored procedure.

Thanks for your help.

Change the command type to Stored Procedure and type

SPMultiValue

Now click OK and hit the refresh button. Now go back to Edit the dataset and go to parameters tab and map it with the correct parameter.

For multi value parameter within stored procedure you need to decode the multi values to be able to use in the query.

|||

Thanks for u'r reply. I have GroupDataBy parameter. Based on that value I need to call different stored procedure.

I have to use commond type As text. Is there any way to pass Multi value parameter for the following statement

"Exec spMultiValue '" & Parameters!Month.Value & "'"

|||Change Parameters!Month.Value to Parameters!Month.IsMultiValue

No comments:

Post a Comment