Monday, September 24, 2012

SSMA error message S2SS0044

Complex expression cannot be used as OUTPUT parameter in EXECUTE Statement

             To avoid this S2SS0044 Error,We should avoid the following scenarios given below:
1.Dont perform calculation,while passing parameter.
2.Dont place brackets on variables of OUTPUT parameter.
3.Dont place constants for OUTPUT parameter

Kindly execute the below test quieries to simulate yourself.
--Create sample procedure
CREATE PROCEDURE dbo.test_proc(@a INT,@b INT OUTPUT)
AS
BEGIN
  SELECT
'HI'

END

--Case1
EXEC dbo.test_proc 1,2 OUTPUT

Msg 179, Level 15, State 1, Line 1
Cannot use the OUTPUT option when passing a constant to a stored procedure.

--Case2

DECLARE @x INT
EXEC
dbo.test_proc 1,[@x] OUTPUT

Msg 179, Level 15, State 1, Line 3
Cannot use the OUTPUT option when passing a constant to a stored procedure.


This S2SS0044 will leads to runtime Error.We can resolve,by removing brackets of the OUTPUT variable or avoiding constant in OUTPUT parameter.

Sample execute statement for the successful Run.
DECLARE @x INT
EXEC
dbo.test_proc 1,@x OUTPUT

Please click here to know about sybase to sql server migration issues

No comments:

Post a Comment