I got this error when trying to run a query in SQL server query analyzer. What is the reason?
-
Which version of SQL server are you using? – Ed Harper Oct 21 '08 at 14:43
-
and can we see the calling code? – Bob Probst Oct 21 '08 at 14:53
-
and have you checked the sql error log? – Ed Guiness Oct 21 '08 at 14:59
-
...and have you read this http://www.catb.org/~esr/faqs/smart-questions.html#beprecise – Ed Guiness Oct 21 '08 at 15:07
2 Answers
If you're using cursors, then you've probably closed the cursor. Check out MSDN for more information (http://support.microsoft.com/kb/151693)
If you're not using cursors, then it could be an issue with the server, check the log.

- 7,431
- 3
- 31
- 33
-
I've made that suggestion and deleted it again. KB151693 is probably a little old. – Tomalak Oct 21 '08 at 15:29
And before it's lost to the sands of time, the KB article:
Article ID: 151693 - Last Review: October 3, 2003 - Revision: 3.0
FIX: Err Msg "Unknown Token Received from SQL Server"
Symptoms
When you set the statement options to use a server-side cursor and prepare a select statement on a SQL Server system table, the first execution of the select creates the cursor successfully. After you close this cursor, if you execute the prepared statement again, the following error message appears:
unknown token received from SQL Server.
Workaround
Use a forward-only cursor instead of a static, keyset, or dynamic cursor on the system tables. Note that the problem does not occur if a server-side cursor is created on a user-defined table or view.
If a forward-only cursor is unacceptable, prepare the select statement again on the system table and execute it to create a server-side cursor. Note that the first execution works fine and applications typically do not need to create a cursor on a system table repeatedly.
Status
Microsoft has confirmed this to be a problem in Microsoft SQL Server version 6.50.0201. This problem has been corrected in U.S. Service Pack 1 for Microsoft SQL Server version 6.5. For more information, contact your primary support provider.

- 246,734
- 253
- 869
- 1,219