I have a SQL Server 2005 box with a classic ASP front end (IIS6) calling a stored procedure that uses dynamic SQL. It works except for a single day of data that somehow throws this error even though it runs fine in SSMS.

Since it works for other date ranges and works within SSMS (with this date range), I'm guessing there must be something in the dataset that's triggering the error. However, calls to it using the date range plus filters that result in no data returned still triggers this error, so I don't think it's related to what's being passed back to the IIS app.

Any suggestions on how I can track this down would be appreciated.


  • You need to add some details - tables, sample data, queries, etc. Without details, we have no way of knowing what the issue is. – Max Vernon May 20 '14 at 23:31
  • The query is fairly involved. I was just trying to understand how this error comes about. Also, today it started working again. From what I read it could be a networking error, except that SQL & the app are on the same machine and we've seen no sign of networking problems beyond this. – William Jens May 21 '14 at 14:07

The error message means client TDS* processing received a token it didn't expect.

This might be a bug, but if so, it is most likely an old one that has long been fixed. You should ensure that the client connectivity components (e.g. MDAC, SQL Server client) are patched up to date (as far as possible, given the old technology).

You should also check that your SQL Server 2005 is running at least Service Pack 4 (though 2005 is out of mainstream support now too).

*tabular data steam; SQL Server's communication protocol

Not the answer you're looking for? Browse other questions tagged or ask your own question.