0 votes
1 view
in SQL by (36k points)

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

1 Answer

0 votes
by (86.8k 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.

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...