Skip to content

EXECUTE

CREATE PROCEDURE MyProcedure
AS
SELECT 'Hello, World!'
GO
EXECUTE MyProcedure
GO
'Hello, World!'

The EXECUTE statement is used to run a stored procedure in SQL Server. In the provided example, a procedure named MyProcedure is created. This procedure, when called, simply returns the string ‘Hello, World!’. The EXECUTE statement is then used to run MyProcedure, resulting in the output ‘Hello, World!’.