Wednesday 21 February 2018

MSSQL - Fix Error - Incorrect syntax near 'OUTPUT'.


Watch this example on YouTube


 

To fix it replace

Declare @SomeValue int = 0 OUTPUT 
Exec spTest3 @SomeValue 
 

with

Declare @SomeValue int = 0
Exec spTest3 @SomeValue
OUTPUT 


where stored procedure looks like:

CREATE PROCEDURE spTest3
    @SomeValue int = 0 OUTPUT
AS
BEGIN
    -- SET NOCOUNT ON added to prevent extra result sets from
    -- interfering with SELECT statements.
    SET NOCOUNT ON;

    SET @SomeValue = 10;
    Return @SomeValue
END
GO

No comments:

Post a Comment