Monday, 28 March 2016

Fix the following error: The variable name '@return_value' has already been declared. Variable names must be unique within a query batch or stored procedure.


Watch this example on YouTube
In order to fix it
replace
DECLARE    @return_value int,        @Success int
EXEC    @return_value = [dbo].[GetAllCustomers] @Success = @Success OUTPUT
SELECT    @Success as N'@Success' SELECT    'Return Value' = @return_value

DECLARE    @return_value int,        @Success int
EXEC    @return_value = [dbo].[GetAllCustomers] @Success = @Success OUTPUT
SELECT    @Success as N'@Success' SELECT    'Return Value' = @return_value

With
DECLARE    @return_value int,        @Success int
EXEC    @return_value = [dbo].[GetAllCustomers] @Success = @Success OUTPUT
SELECT    @Success as N'@Success' SELECT    'Return Value' = @return_value
GO

DECLARE    @return_value int,        @Success int
EXEC    @return_value = [dbo].[GetAllCustomers] @Success = @Success OUTPUT
SELECT    @Success as N'@Success' SELECT    'Return Value' = @return_value
GO

No comments:

Post a Comment