BUG: SQL Server 6.5 Message 5161 has Severity 1

ID: Q235697


The information in this article applies to:
  • Microsoft SQL Server version 6.5

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 version 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.

Additional query words:

Keywords : SSrvProg SSrvTran_SQL kbSQLServ650bug
Version : winnt:6.5
Platform : winnt
Issue type : kbbug


Last Reviewed: August 12, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.