Icon LOAD UPDATES

Loads all logged updates from an update file into the specified database.

Syntax
LOAD UPDATES FOR DATABASE <Name>
FROM <UpdateName> IN STORE <StoreName>
[TABLES <TableName> [,<TableName>]]
[MERGE DUPLICATE INSERTS]
[IGNORE|INSERT MISSING UPDATES]
[DISABLE TRIGGERS]

Usage
Use this statement to load an update file that has been created from logged updates for a different copy of the database from the specified store. The store must have already been created using the CREATE STORE statement, and must be a local store.

The TABLES clause is optional and allows you specify a subset of tables from the database for loading. The default behavior is to load the logged updates for all tables in the database.

The MERGE DUPLICATE INSERTS clause is optional and allows you to specify that row inserts whose primary key already exists are treated as updates. By default, row inserts whose primary key already exists will cause an exception to be raised.

The IGNORE/INSERT MISSING UPDATES clause is optional and allows you to specify that either:
  • Row updates whose primary key cannot be found in the target table be ignored and not raise an exception. (IGNORE)


  • Row updates whose primary key cannot be found in the target table be converted into inserts. (INSERT)
By default, row updates whose primary key cannot be found will cause an exception to be raised. Also, row deletions whose primary key cannot be found are always ignored since such a situation is considered equivalent to a row deletion.

The DISABLE TRIGGERS clause is optional and allows you to specify that all tables being updated should have all of their triggers disabled before any updates are loaded. The current state of the triggers is saved before the triggers are disabled, and restored after the updates are finished loading.

If loading multiple update files from the same source database, it is important that you load the update files in the creation order dictated by the creation timestamp of the update files. You can use the SET UPDATES STORE statement with the Updates table in the Configuration database to retrieve a list of the updates in a given store and order them by their creation timestamp.

Information The creation timestamp is stored inside of the update file and is different from the operating system's file creation timestamp.

The load process automatically uses a transaction to ensure that the load is done in an atomic fashion. If any errors occur during the load, then the entire process is rolled back.

You can use the CREATE TABLE FROM UPDATES clause to create a table that contains the contents of any given update file. This is useful for auditing purposes, or for debugging issues when loading a particular update file into a database.

Please see the Replication topic for more information on loading updates for a database.

Examples
-- This example loads the updates for the
-- Transaction table in the Accounting database

LOAD UPDATES FOR DATABASE Accounting
FROM "AccountingDB-Updates-2007-03-12"
IN STORE TransactionUpdatesIn
TABLES Transaction

Required Privileges
The current user must be granted the MAINTAIN privilege on the current database in order to execute this statement. Please see the User Security topic for more information.

SQL 2003 Standard Deviations
This statement deviates from the SQL 2003 standard in the following ways:

DeviationDetails
ExtensionThis SQL statement is an ElevateDB extension.
Image