Extract T-SQL Object's Body to Separate Script
Introduction
Section titled “Introduction”The Extract T-SQL Object’s Body to Separate Scriptcommand creates a new SQL document and extracts the selected body of the selected CREATE/ALTER procedure, function, or view to the new document.
The Extract T-SQL Object’s Body to Separate Scriptcommand extracts the body of the selected stored procedure, view, or function into a separate SQL document.
To extract the selected code:
-
Select CREATE/ALTER PROCEDURE/VIEW/FUNCTION script which you want to extract.
-
On the SQL Enlight->Refactormenu, click Extract T-SQL Object’s Body to Separate Script.
-
The Extract T-SQL Object’s Body to Separate Scriptdialog box is displayed.
The resulting SQL script is displayed in the Previewbox.

-
Review the generated script in the Previewbox and modify it if necessary.
-
Click Applybutton to apply the changes.
Parameters
Section titled “Parameters”The parameters of the new objects are determined from the variables which are referenced in the selected code.
SQL Enlightautomatically resolves the data type and the direction of these parameters. If a variable is used but declared nowhere in the script, its declaration in the resulting script will have sql_variantdata type.