Microsoft KB Archive/235697

= BUG: SQL Server 6.5 Message 5161 has Severity 1 =

Article ID: 235697

Article Last Modified on 10/3/2003

-

APPLIES TO


 * Microsoft SQL Server 6.5 Standard Edition

-



This article was previously published under Q235697



BUG #: 18774 (SQLBUG_65)



SYMPTOMS
If an application performs a "USE dbname" on a 6.5 database that is offline, no error occurs although the USE command fails. Message 5161,

"Database '%.*s' is marked offline"

is returned to the client, but the USE command may appear successful because error 5161 has a severity level of 1.



WORKAROUND
For a DB-Library application, use the function dbuse to change the database context instead of directly running "USE databasename". The dbuse function properly handles the case when a database is offline, and returns FAIL.

For an ODBC application, check for the result SQL_SUCCESS_WITH_INFO after executing a "USE database", and look for error 5161 when processing any messages.

Alternatively, you can run sp_dboption to check whether the "Offline" database option is currently set before attempting to change the database context. For example: sp_dboption pubs, 'offline'



STATUS
Microsoft has confirmed this to be a problem in SQL Server 6.5.



MORE INFORMATION
In the SQL Server 6.5 Books Online, message 5161 is documented as a severity 16 error.

Databases that are commonly placed offline (through the sp_dboption stored procedure) are those that are located on removable media, such as a CD-ROM.

Keywords: kbbug kbpending KB235697

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.