BUG: Use <Database> Does Not Properly Change @@DBTS Context

ID: Q157518


The information in this article applies to:

BUG #: 15634 (WINDOWS 6.50)

SYMPTOMS

The Use <Database> statement does not change the context of the @@DBTS, unless the Use <Database> statement is run in a separate Transact-SQL batch.


WORKAROUND

To work around this problem place the Use <Database> statement in a separate batch.


STATUS

Microsoft has confirmed this to be a problem in Microsoft SQL Server versions 6.0 and 6.5. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

The following query demonstrates the problem:

use pubs
go
select db_name(), @@DBTS
go
use tempdb
select db_name(), @@DBTS
go
select db_name(), @@DBTS
go 

The following is the result of the query above:

------------------------------ ------------------
pubs                           0x0100000097180000

**ERROR, database context is really tempdb but @@DBTS value belongs to
PUBS

------------------------------ ------------------
tempdb                         0x0100000097180000

------------------------------ ------------------
tempdb                         0x010000003e1a0000 


Keywords          : kbusage SSrvTran_SQL kbbug6.50 kbbug6.00 
Version           : 6.0 6.5
Platform          : WINDOWS 
Issue type        : 

Last Reviewed: April 3, 1999