INF: dbnextrow Does Not Return Fail on Deadlock (109649)



The information in this article applies to:

  • Microsoft SQL Server 4.2x
  • Microsoft SQL Server 2000 (all editions)

This article was previously published under Q109649
BUG# NT: 9739 (4.2)
		

SUMMARY

If a process running dbnextrow() is chosen as the victim of a deadlock resolution (SQL Server error 1205) the call to dbnextrow() will return NO_MORE_ROWS.

The SQL Server message handler will be invoked with the correct message number (1205). The DB-Library (DB-Lib) error handler will not be invoked.

The following is the SQL Server error 1205:
Your server command (process id #%d) was deadlocked with another process and has been chosen as deadlock victim. Re-run your command.

MORE INFORMATION

This is the expected behavior of DB-Library. To handle the condition, check for error 1205 in the message handler, and use the dbsetuserdata function to communicate this to your application. An example can be found in Chapter 4 on DB-Library functions in the SQL Server "Programmers Reference for C" under dbsetuserdata.

Additionally, you can find an example of how to detect a deadlock condition in "Appendix E Maximizing Consistency and Concurrency" in the SQL Server for Windows NT "Programmer's Reference for C".

Modification Type:MinorLast Reviewed:2/22/2005
Keywords:kbinfo kbProgramming KB109649