Help Center > > User Guide> Microsoft SQL Server Database Management> Stored Procedure Management> Creating a Stored Procedure

Creating a Stored Procedure

Updated at: Mar 20, 2020 GMT+08:00

Scenarios

A stored procedure consists of a set of SQL statements that can complete specific tasks or processes complex services. This section describes how to create a stored procedure. You can use loop statements in a stored procedure to insert objects repeatedly.

Prerequisites

  • You have obtained the login permission and logged in to the database management page.
  • You have obtained the CREATE ROUTINE permission for creating stored procedures and the ALTER ROUTINE permission for altering and dropping stored procedures.

Procedure

  1. In the navigation tree on the left, right-click Stored Procedures under the target database and choose Create Stored Procedure from the shortcut menu.
  2. On the page for editing a stored procedure, click Set Template Parameter. In the displayed dialog box, set required parameters and click OK.
  3. Edit the SQL statements and click Save. The main part of the stored procedure is adjusted according to the settings.
  4. Click Execute. In the displayed dialog box, set required parameters and click Execute.
  5. View the execution results on the Message and Result Set tabs.

Did you find this page helpful?

Submit successfully!

Thank you for your feedback. Your feedback helps make our documentation better.

Failed to submit the feedback. Please try again later.

Which of the following issues have you encountered?







Please complete at least one feedback item.

Content most length 200 character

Content is empty.

OK Cancel