This article was previously published under Q295006
This article has been archived. It is offered "as is" and will no longer be updated.
BUG #: 353107 (SHILOH_BUGS)
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 theMicrosoft 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.