Viewing the Transaction Log | Database Journal

Viewing the Transaction Log

Jul 28, 2000
1 minute read



Introduction

SQL Server 6.5

SQL Server 7.0

Literature

Introduction

In this article I want to show how you can view the SQL Server transaction
log for version 6.5 and for version 7.0.

It’s not necessary to view the SQL Server transaction log, but if you
are a DBA, it may be useful to resolve some problems. It may be useful
for understanding the internal SQL Server architecture too.


SQL Server 6.5

Every database contains the syslogs system table in SQL Server 6.5.
This table contains the transaction log, and is used by SQL Server
for recovery and roll forward. You can not modify syslogs system
table manually.

This is from SQL Server Books Online (fields of syslogs table):

Column  Datatype        Description
xactid  binary(6)       Transaction ID
op      tinyint         Update-operation number

So, to view the transaction log you can use the following select statement:

SELECT xactid AS TRAN_ID, op AS LOG_RECORD FROM syslogs

There are some op values:

op = 0  – BEGIN TRANSACTION
op = 4  – Insert Row
op = 5  – Delete Row
op = 9  – Modify Row
op = 30 – END TRANSACTION


Advertisement

SQL Server 7.0

There is no syslogs system table in SQL Server 7.0. The database
log is now an operating system file. So this SQL statement:

SELECT xactid AS TRAN_ID, op AS LOG_RECORD FROM syslogs

will return error:

Server: Msg 208, Level 16, State 1, Line 1
Invalid object name ‘syslogs’.

You can use the following undocumented command in this case:

DBCC log ( {dbid|dbname}, [, type={0|1|2|3|4}] )

PARAMETERS:

   Dbid or dbname - Enter either the dbid or the name of the database
                    in question.

      type - is the type of output:

      0 - minimum information (operation, context, transaction id)

      1 - more information (plus flags, tags, row length)

      2 - very detailed information (plus object name, index name,
          page id, slot id)

      3 - full information about each operation

      4 - full information about each operation plus hexadecimal dump
          of the current transaction log's row.

by default type = 0

To view the transaction log for the master database, you can run the
following command:

DBCC log (master)

See All Articles by Columnist Alexander Chigrik

Alexander Chigrik

I am the owner of MSSQLCity.Com - a site dedicated to providing useful information for IT professionals using Microsoft SQL Server. This site contains SQL Server Articles, FAQs, Scripts, Tips and Test Exams.

Database Journal Logo

DatabaseJournal.com publishes relevant, up-to-date and pragmatic articles on the use of database hardware and management tools and serves as a forum for professional knowledge about proprietary, open source and cloud-based databases--foundational technology for all IT systems. We publish insightful articles about new products, best practices and trends; readers help each other out on various database questions and problems. Database management systems (DBMS) and database security processes are also key areas of focus at DatabaseJournal.com.

Property of TechnologyAdvice. © 2026 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.