SQL SERVER – Fix – Error – 11537 – EXECUTE statement failed because its WITH RESULT SETS clause specified column(s) for result set number, but the statement sent column(s) at run time.


SQL Server Portal

EXECUTE statement failed because its WITH RESULT SETS clause specified %d column(s) for result set number %d, but the statement sent %d column(s) at run time is one of the new error messages seen in SQL Server 2012. This error message is due to the invalid use of new feature EXEC WITH RESULT SETS.

Let’s discuss this in detail:
Message Number: 11537

Severity : 16

Error Message: EXECUTE statement failed because its WITH RESULT SETS clause specified %d column(s) for result set number %d, but the statement sent %d column(s) at run time.

Error Generation:
Let me create a sample stored procedure to generate this error.

errormessage11537.1.2

You can see that the above stored procedure is executed successfully and it has ONE result sets with TWO columns.
Lets try to execute it using WITH RESULT SETS clause.

Msg 11537, Level 16, State 1, Procedure usp_Resultset, Line 3
EXECUTE statement failed…

View original post 129 more words