Share via


Change Tracking

Change tracking in SQL Server 2008 enables applications to obtain only changes that have been made to the user tables, along with the information about those changes. With change tracking integrated into SQL Server, complicated custom change tracking solutions no longer have to be developed.

Change tracking is an important building block for applications that synchronize and replicate data in scenarios in which end-to-end replication solutions do not work and a custom solution is required. For example, a scenario that requires synchronizing data with data stores that are not SQL Server databases or in which the store schemas are very different.

In This Section

  • Change Tracking Overview
    Describes change tracking, provides a high-level overview of how change tracking works, and describes how change tracking interacts with other SQL Server Database Engine features.

  • Configuring and Managing Change Tracking
    Provides a walkthrough of how to configure change tracking and how to manage change tracking data.

  • Using Change Tracking
    Shows how to use change tracking to enumerate changes and do one-way and two-way synchronization.

Function

Description

CHANGETABLE (Transact-SQL)

Obtains tracking information for all changes to a table that have occurred since a specified version or the latest change tracking information for a specified row.

CHANGE_TRACKING_MIN_VALID_VERSION (Transact-SQL)

Obtains the minimum version that is valid for use in obtaining change tracking information from the specified table when you are using the CHANGETABLE function.

CHANGE_TRACKING_CURRENT_VERSION (Transact-SQL)

Obtains a version that is associated with the last committed transaction. You can use this version the next time that you enumerate changes by using CHANGETABLE.

CHANGE_TRACKING_IS_COLUMN_IN_MASK (Transact-SQL)

Interprets the SYS_CHANGE_COLUMNS value that is returned by the CHANGETABLE(CHANGES …) function.

WITH CHANGE_TRACKING_CONTEXT

Enables the specification of a change context, such as an originator ID, when an application changes data.

Catalog view

Description

sys.change_tracking_databases (Transact-SQL)

Returns one row for each database in the instance of SQL Server that has change tracking enabled.

sys.change_tracking_tables (Transact-SQL)

Returns one row for each table in the current database that has change tracking enabled.