Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


Error 16937 and 16945?

Error 16937 and 16945?

Error 16937 and 16945?

When using the Profiler to assess some hangups in one of our VB applications, I keep randomly seeing these two errors:
Error 16937 and 16945

Any idea what they are, or where I can find what they mean?



RE: Error 16937 and 16945?

This is a little something from Microsoft:

FIX: SQL Server ODBC Driver Generates Error When Executing a Stored Procedure on SQL Server 2000
Article ID : 286359
Last Review : November 3, 2003
Revision : 3.0
This article was previously published under Q286359
On this Page

An application that uses the Open Database Connectivity (ODBC) application programming interface (API) to call a SQL Server 2000 stored procedure that has a return value with the SQLExecDirect() API function and open a cursor on the resulting table may return the following errors:
szSqlState = "42000", *pfNativeError = 170, *pcbErrorMsg = 81 MessageText = "[Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near '?'."
szSqlState = "42000", *pfNativeError = 16945, *pcbErrorMsg = 75 MessageText = "[Microsoft][ODBC SQL Server Driver][SQL Server]The cursor was not declared."
Before the SQL Server ODBC driver sends the command to the SQL Server, it restructures the ODBC call syntax to the SQL Server sp_opencursor command syntax. In the process of restructuring the command, the driver does not put a space after the name of the stored procedure. For example, calling this stored procedure causes the SQL Server ODBC driver to generate the following sp_cursoropen call.
Table Schema and Stored Procedure
create table testtable
(f1 integer)
create proc testproc
@p1 integer
select * from testtable where f1 = @p1
return 2
ODBC Call Syntax
{? = call testproc(?)}
Resulting Call to SQL Server 2000
exec sp_cursoropen @P1 output, N' EXEC @P1=testproc@P2? ', @P2 output, @P3 output, @P4 output, N'@P1 int OUTPUT,@P2 int', @P5 output, 1
Note that the second parameter and the name of the stored procedure do not have a space between them; this causes the syntax error.
To resolve this problem, obtain the latest service pack for Microsoft Data Access Components 2.6. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:
300635 INFO: How to Obtain the Latest MDAC 2.6 Service Pack
The English version of this fix should have the following file attributes or later:
   Date      Time    Version        Size     File name     Platform
   02/15/01  5:53P   2000.80.256.0  28,742   Odbcbcp.dll    x86
   02/15/01  5:53P   2000.80.256.0  471,119  Sqlsrv32.dll   x86
   02/15/01  5:44P   2000.80.256.0  90,112   Sqlsrv32.rll   x86

Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article. This problem was first corrected in Microsoft Data Access Components 2.6 Service Pack 1.

RE: Error 16937 and 16945?

Wow, thanks mihaildamjan,

I'm reviewing all those articles now and will let you know the result.

Very much appreciate your time to post!



RE: Error 16937 and 16945?

Very close mihaildamjan,

Seems I have MDAC version 2.8, so technically this bug should be fixed already.

I keep my eyes open and see if there is anything else.

Thanks again,


Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close