FIX : OSQL Utility Returns Incorrect Error Message

Article translations Article translations
Article ID: 295006 - View products that this article applies to.
This article was previously published under Q295006
BUG #: 353107 (SHILOH_BUGS)
Expand all | Collapse all


When the OSQL utility is used to execute a query that is longer than 1002 characters, an incorrect error message may be returned:
Msg 3909, Level 16, State 1, Server Server_Name, Procedure sp_bindsession, Line 0
Session binding token is invalid.
The correct error message should be the following:
Input query is too long


The input buffer for the OSQL utility is limited to 1002 characters.


To resolve this problem, obtain the latest service pack for SQL Server 2000. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:
290211 INF: How to Obtain the Latest SQL Server 2000 Service Pack


To work around this problem, you can do the following:
  • Specify an input query that is shorter than 1002 characters.
  • Place the batch in an input file and pass the input file name to OSQL with the /i parameter.


Microsoft has confirmed that this is a problem in SQL Server 2000. This problem was first corrected in SQL Server 2000 Service Pack 1.


This problem does not occur on Microsoft Windows 95 and Windows 98 because these operating systems cannot handle a command-line argument that is greater than 1002 characters. If an argument of that length is specified at the command prompt, or in a batch file, it is truncated by the operating system.


Article ID: 295006 - Last Review: November 5, 2003 - Revision: 3.2
  • Microsoft SQL Server 2000 Standard Edition
kbbug kbfix kbsqlserv2000sp1fix KB295006

Give Feedback


Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from