Loading, please wait...

How to Create Procedure?

How To Create Stored Procedure In SQL

 

Introduction:
In this article, you will learn to create, modify and drop stored procedure in SQL.

Here, now we create a stored procedure in our database.

 

Create a Stored Procedure

Step 1: We will pick the data fields of our existing table in the database. We create stu table to show the created procedure.

 

 

 

Step 2: Now, select and execute this command.

 

 

 

Step 3: To show the result, we will write the statement, given below:

 

 

 

The output of this query is:

 

 

 

Modifying a Stored Procedure

Step 1: We write the query to modify a stored procedure.

 

 

 

Step 2: Select and execute this command.

 

 

 

Drop a Stored Procedure

Step 1: We will write the query to drop a stored procedure and then execute this query.

 

 

 

If you want to see, where this stored procedure is stored, use the following procedure:

Expand databases -> Expand the database, where your table is present -> Programmability -> Stored Procedure -> System Stored Procedure.

 

 

Summary:

Thus, we learnt to create, modify and drop a stored procedure in SQL.