PurgeTransactionSequenceData Method

Purges the specified data from the transaction history table.

Namespace:  System.Data.SqlServerCe
Assembly:  System.Data.SqlServerCe (in System.Data.SqlServerCe.dll)

Syntax

'Declaration
Public Sub PurgeTransactionSequenceData ( _
    pType As PurgeType, _
    retentionValue As Long _
)
'Usage
Dim instance As SqlCeChangeTracking
Dim pType As PurgeType
Dim retentionValue As Long

instance.PurgeTransactionSequenceData(pType, _
    retentionValue)
public void PurgeTransactionSequenceData(
    PurgeType pType,
    long retentionValue
)
public:
void PurgeTransactionSequenceData(
    PurgeType pType, 
    long long retentionValue
)
member PurgeTransactionSequenceData : 
        pType:PurgeType * 
        retentionValue:int64 -> unit 
public function PurgeTransactionSequenceData(
    pType : PurgeType, 
    retentionValue : long
)

Parameters

  • retentionValue
    Type: System. . :: . .Int64
    A number that specifies the limit up to which rows should be retained. In the case of a time based purge the parameter specifies the number of days from the present date for which to retain transaction history data. In the case of a CSN based purge, the parameter specifies the CSN of the last transaction for which transaction history data should be retained.

Exceptions

Exception Condition
ArgumentOutOfRangeException

retentionValue is less than zero.

-or-

purgeType is not a valid PurgeType value.

Remarks

As transactions commit, an entry is made into the transaction history table (__sysTxCommitSequence) that contains tracking information relevant to the transaction. You can limit the size of this table by deleting rows for transactions that are no longer relevant to your application.

You can specify one of two types of purge by using the pType parameter:

  • A time based purge. In the case of a time based purge, the retentionValue parameter specifies the number of days from the current date for which rows are retained in the transaction history table. Any row that was modified on or after the retention date is retained; any row that was modified before the retention date is deleted.

  • A CSN based purge. This type of purge is also known as a transaction based purge. In the case of a CSN based purge, the retentionValue parameter specifies the transaction commit sequence number (CSN) of the last transaction for which to retain rows in the transaction history table. Rows that were last modified by a transaction with a CSN that is greater than or equal to the specified CSN are retained; those that were last modified by a transaction with a CSN less than the specified CSN are deleted. You can get the current CSN for a data source (the CSN assigned to the last transaction to commit) by calling the GetLastCommittedCsn method.

    Note

    The CSN is a monotonically incrementing counter that is assigned by the database to each transaction (in which the database is enlisted) when it commits. The CSN uniquely identifies the sequence in which each transaction was committed relative to other transactions that that have committed in which the database was also enlisted.

For more information about the differences between performing a time based purge and a CSN based purge, see the topic for the PurgeType enumeration.

See Also

Reference

SqlCeChangeTracking Class

SqlCeChangeTracking Members

System.Data.SqlServerCe Namespace

PurgeType

GetLastCommittedCsn