BEGIN TRANSACTION Command

Example   See Also

Begins a transaction. Transactions are supported only for tables in a database. See CREATE DATABASE and ADD TABLE for information on how to create and add tables to a database.

Syntax

BEGIN TRANSACTION

Remarks

To save any modifications you made and end the transaction, issue END TRANSACTION. If the transaction fails (the server fails, the workstation fails, or you exit Visual FoxPro without committing the transaction) or if you issue ROLLBACK, the file or files in the transaction are restored to their original state.

Transactions can be nested five levels deep. An error is generated if you attempt a sixth level of nesting.

When you modify records in a table that is part of a transaction, other users on the network do not have access (read or write) to the records until you end the transaction.

When other users on the network try to access records you have modified, they must wait until you end your transaction. They receive the message "Record not available ... please wait" until the records become available. Because of this, it is important to keep the length of the transaction to a minimum or conduct the transaction during times when others do not need access.

The following commands and functions are not supported during a transaction:

Commands and functions
ADD TABLE DELETE CONNECTION
APPEND PROCEDURES DELETE DATABASE
CLEAR ALL DELETE TRIGGER
CLOSE ALL1 DELETE VIEW
CLOSE DATABASES1 MODIFY CONNECTION
COPY INDEXES MODIFY DATABASE
COPY PROCEDURES MODIFY PROCEDURE
CREATE CONNECTION MODIFY VIEW
CREATE DATABASE REMOVE TABLE
CREATE TRIGGER RENAME TABLE
CREATE VIEW REQUERY( )
CREATE SQL VIEW

1 If CLOSE ALL is issued while a transaction is in progress, all tables in all open databases are closed. However, the databases remain open. Issuing CLOSE DATABASES within a transaction closes all tables in the current database, but the database remains open.

Also, the following commands and functions cannot be issued for a specific table participating in a transaction:

Commands and functions
ALTER TABLE MODIFY STRUCTURE
CREATE TABLE PACK
CURSORSETPROP( ) REINDEX
DELETE TAG TABLEREVERT( )
INDEX ZAP
INSERT