Skip to content

EXEC

CREATE PROCEDURE MyProcedure
AS
PRINT 'Hello World'
GO
EXEC MyProcedure
Hello World

The example demonstrates the use of EXEC command. First, we create a procedure named MyProcedure using CREATE PROCEDURE which prints ‘Hello World’. After that, we execute the procedure using the EXEC command. The output is the string ‘Hello World’ printed by the executed procedure.