TransactionType Property

Sets the transaction type.

Applies To

  • Dataports

  • XMLports

Remarks

There are four basic transaction types: Browse, Snapshot, UpdateNoLocks, and Update. Each transaction type defines the behavior of a transaction in Microsoft Dynamics NAV and takes effect from the beginning of a transaction.

Additionally, there is a Report option that maps to one of the basic options. This enables a report to use the most concurrent read-only form of data access for the connected server. When you use Microsoft Dynamics NAV Database Server, it maps to Snapshot and when you use SQL Server, it maps to Browse.

The following table shows transaction behavior when using SQL Server.

Transaction Type Behavior

Browse

This is a read-only transaction. Modifications cannot occur within the transaction. All read operations are performed with READ UNCOMMITTED locking. Therefore, no locks are placed and locks placed by other sessions are not honored. This means that it is possible to read uncommitted data.

Snapshot

This is a read-only transaction. Modifications cannot occur within the transaction. All read operations are performed with SERIALIZABLE locking. Therefore, share-locks are placed and maintained until the end of the transaction. This guarantees a consistent snapshot of the data read within the transaction.

Microsoft's definition of "SERIALIZABLE" is as follows, "A transaction isolation level that ensures that a database changes from one predictable state to another. If multiple concurrent transactions can be executed serially, and the results are the same, the transactions are considered serializable."

For more information about SERIALIZABLE locking, consult Microsoft's SQL Server documentation.

UpdateNoLocks

This is an update transaction. Modifications can occur within the transaction. The locking behavior for read operations on each table is the same as for the Browse transaction type until the table is either modified by a write operation or locked with the Record.LOCKTABLE function. From this point until the end of the transaction, all read operations are performed with both SERIALIZABLE and UPDLOCK locking.

This transaction type improves concurrency for all tables that users access within the transaction by delaying locking as much as possible. However, the disadvantage is that you must know when to lock the tables for the required transaction behavior.

This is the default transaction type if you have not specified a type with the CURRENTTRANSACTIONTYPE Function (Database).

Update

This is an update transaction. Modifications can occur within the transaction. The locking behavior for read operations on each table is the same as for the Snapshot transaction type until the table is either modified by any write operation or locked with the Record.LOCKTABLE function. From this point forward, all read operations are performed with both SERIALIZABLE and UPDLOCK locking.

This transaction type provides full transaction isolation from the beginning of the transaction, regardless of the lock status of tables that users access within the transaction.

See Also

Reference

CURRENTTRANSACTIONTYPE Function (Database)