How to: Run Stored Procedures and User-Defined Functions
You can run stored procedures and user-defined functions against your database and display the results in the Output window. Stored procedures and user-defined functions must be saved before you can run them. If you attempt to run an unsaved SQL routine, a message prompts you to save it first.
Note
Your computer might show different names or locations for some of the Visual Studio user interface elements in the following instructions. The Visual Studio edition that you have and the settings that you use determine these elements. For more information, see Visual Studio Settings.
To run a stored procedure
In Server Explorer, expand the Stored Procedures folder.
Right-click the name of the stored procedure that you want to run.
Choose Execute on the shortcut menu. The Output window shows the status of the stored procedure.
If the stored procedure contains parameters, the Run Stored Procedure dialog box prompts you for the parameter values. In the Value column, type a value for each parameter that appears in the Name column, and then click OK. For details about parameters, see How to: Use Parameters in Stored Procedures and User-Defined Functions.
The Output window is updated with status information as the stored procedure is run. The Output window also displays result sets and return values for the stored procedure.
To run a user-defined function
In Server Explorer, expand the Functions folder.
Right-click the name of the function that you want to run and click Execute on the shortcut menu. The Output window shows the status of the function.
If the function contains parameters, the Run Stored Procedure dialog box prompts you for the parameter values In the Value column, type a value for each parameter that appears in the Name column, and then click OK. For details about parameters, see How to: Use Parameters in Stored Procedures and User-Defined Functions.