'Encapsulate As New Stored Procedure' doesn't include variables as parameters

SQL Prompt's Encapsulate As New Stored Procedure feature allows you to create a new stored procedure from selected SQL code. 

mceclip4.png

Parameters will automatically be created from any variables found in the same script. In order for this to work, however, you must ensure that the variables are both declared and their values are set outside of the text you've selected for encapsulation.

In the examples below, the @MyCounter parameter will be added if the text in blue is selected:

DECLARE @MyCounter INT = 0
SELECT @MyCounter = 1
DECLARE @MyCounter INT;
Set @MyCounter = 5;
SELECT @MyCounter = 4;

Was this article helpful?

0 out of 0 found this helpful
Have more questions? Submit a request