How to fix "Msg 11535, Level 16, State 1,"

Naomi Nosonovsky 8,791 Reputation points
2025-10-06T01:42:36.78+00:00

I have a complex procedure returning one result set.

However, when I execute using WITH RESULT SETS I'm getting this error:

Msg 11535, Level 16, State 1, Procedure im_automation.accent_changes, Line 814 [Batch Start Line 0]

EXECUTE statement failed because its WITH RESULT SETS clause specified 1 result set(s), and the statement tried to send more result sets than this.

I'm not understanding why I'm getting such error. The procedure returns just a single query.

SQL Server | SQL Server Transact-SQL
{count} votes

Answer accepted by question author
  1. Harry Vo (WICLOUD CORPORATION) 3,380 Reputation points Microsoft External Staff Moderator
    2025-10-06T08:27:33.32+00:00

    Hi @Naomi Nosonovsky ,

    The error is already said it all: the procedure sends one or more additional result sets before or after that final SELECT. You can verify this by run the line EXEC im_automation.accent_changes; in SSMS.

    I suspect SET STATISTICS IO ON and SET STATISTICS TIME ON might send information as additional result sets. Please try remove it.

    Also try verifying all the SELECT statements you use in the query to make sure there is only one result sets in the final SELECT.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.