Sql-server – Execute stored procedure with an Output parameter


I have a stored procedure that I am trying to test. I am trying to test it through SQL Management Studio. In order to run this test I enter …

exec my_stored_procedure 'param1Value', 'param2Value'

The final parameter is an output parameter. However, I do not know how to test a stored procedure with output parameters.

How do I run a stored procedure with an output parameter?

Best Solution

The easy way is to right-click on the procedure in Sql Server Management Studio(SSMS),

select execute stored procedure...

and add values for the input parameters as prompted.

SSMS will then generate the code to run the proc in a new query window, and execute it for you. You can study the generated code to see how it is done.