Home    |    Concepts   |   API   |   Samples
Concepts > Versioning > SQL Access using Multi-Version Views
Using Multiversioned Views

A multiversioned view presents a SQL application with the appropriate rows for a specified version of the database. The desired version is set by the application using the SQL Stored Procedure set_current_version ('<desired version>'). This stored procedure validates the supplied version name, and sets the corresponding state internally; if no version is specified, the DEFAULT version is used. It is recommended that you create a separate version in which to make attribute edits using multiversioned views.

Note: The exact syntax used to execute the stored procedures and the names of the stored procedures differs from database to database. In these examples, syntax that uses the base function name, e.g. set_current_version ('<desired version>') is used. Refer to the ArcGIS Server or ArcGIS Desktop help topic, What are multiversioned views, for the correct stored procedures and syntax for your database.

Triggers are placed on the version table view for insert, update, and delete operations. Applications that need to insert, update, or delete rows in a versioned table should set the desired version using the same stored procedure, set_current_version ('<desired version>'). The trigger validates the user and version prior to performing inserts, updates, or deletes.

Before editing can occur, the version must be open for editing with the stored procedure edit_version ('<desired version>', 1). Editing is open on the version when the second parameter of the edit_version stored procedure—the edit action—is set to 1. To close editing, call the stored procedure edit_version again with the edit action parameter set to 2.

For example, to call a specific version, Gordon, and open editing:

set_current_version ('Gordon')
edit_version ('Gordon',1)

To close editing:

edit_version ('Gordon',2)

The set_current_version ('desired version') needs to be called once to set the initial version you want to access. You can call it again to switch to another version while in the same session.

feedback | privacy | legal