Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in SQL by (55.6k points)

Can anyone tell me how to create a stored procedure in SQL?

1 Answer

0 votes
by (119k points)

A stored procedure is a prepared SQL code that you can save and can reuse whenever you want. If you have a SQL query that you need to run multiple times, save that as a stored procedure and use the EXEC command to reuse it.

Here is the syntax to create a stored procedure in SQL:

CREATE PROCEDURE procedure_name
AS
sql_statement
GO;

Use the following EXEC command to reuse the stored procedure:

EXEC procedure_name;

I suggest this SQL Certification program by Intellipaat to learn SQL and writing complex SQL queries.

Browse Categories

...