SQL Server Q&A

As a software engineer, I focus on .NET, especially asp.net, C#, WCF and so on, and I am also very interested in Search Engine Optimization.

Entries Tagged ‘DB-Library’

FIX: Parallel Hash Join with Empty Result Set Incorrectly Flows Error Back on Client Connection

Symptoms
If you run a SQL Server Data Manipulation Language (DML) statement from a DB-Library based application against a Microsoft SQL Server 7.0 server, the error handler for the application may incorrectly fire and only report the following error message:

DB-LIBRARY Error 10007, Severity 5:
General SQL Server error: Check messages from the SQL Server.Note that this error message accompanies a wide range of SQL Server errors that are reported back to the client from the server. However, in this scenario the preceding error message is the only error reported and it is not accompanied by any other specific error messages.
Resolution
If a parallel hash join produces an empty result set, internal exception 3602 is used to coordinate the shutdown of worker threads that were created to process the parallel hash plan. The internal 3602 exception is an internal control exception that is used to direct processing flow inside SQL Server and is expected behavior in this case.
However, the fact that it is causing an error to be sent back on the client connection, which in turn causes the DB-Library error handler to fire is not expected behavior.

FIX: DB-Library sp_cursor Fails with Error Message 16933 if Bracketed Identifiers are Passed with the Tablename Parameter

Symptoms
When you use the DB-Library API server cursors, if the table name parameter that is passed to the sp_cursor stored procedure includes a bracketed identifier, the execution of sp_cursor fails with the following error message:

SQL Server message 16933, state 2, severity 16:
The cursor does not include the table being modified or the table is not updatable through the cursor.Refer to the “More Information” section of this article for an example and additional symptoms.
Resolution
SQL Server is unable to successfully parse the bracketed table name with spaces.
DB-Library binds the table name as a SQLCHAR data type, which has a fixed length of 255 characters (the maximum length of this data type). The buffer holds the table name, including the brackets, with the remaining bytes padded with spaces.