Test a stored procedure in Microsoft Sql Server Management Studio
22,852
Not sure of best approach here is how I do it:
You can right click the sp > tasks > execute to > new query window. This will allow you to call the SP with parameters.
You can then do selects at various points in the SP for debugging.
The otehr way if it is a really complex SP is to take the code out of an SP and just declare variables in place of the paremeters then you can just run the TSQL code directy.
WOuld love to hear any better ways though.
Author by
MBU
Updated on January 30, 2020Comments
-
MBU over 4 years
How can you test an existing stored procedure in Microsoft Sql Server Management Studio?
-
MBU over 13 yearsSorry, how do I declare the variables in place of parameters? This is the first time im using microsoft sql server management studio.
-
josh fernandez over 13 yearsJust comment out the parameters then declare tsql variables with the same names then set the variable values to be whatever you want.-- Declare the variable to be used. DECLARE @MyCounter int; -- Initialize the variable. SET @MyCounter = 0;