Views in an enterprise geodatabase

There are four types of views you can use in an enterprise geodatabase:

Database views

Database views are stored queries that select data from specified tables. You can define views on database or enterprise geodatabase tables that are not registered as versioned. When used with an enterprise geodatabase, database views can be defined for a single nonversioned table or between two nonversioned tables. Or you can create more complex views that contain subqueries.

Views used with ArcGIS can contain one spatial column. If a spatial column is present, these views can be referred to as spatial views. Note that when you create a spatial view, you must include the ObjectID column from the same table as the spatial column. If you don't include the ObjectID from the feature class, it violates the unique relationship between the ObjectID and shape column, resulting in inaccurate results when the view is queried or rendered in ArcGIS.

You cannot edit database views through ArcGIS clients or services.

The following are some reasons you would use database views:

You can use the Create Database View geoprocessing tool or the database context menu in ArcGIS Desktop to create a database view, or use the native SQL of your database management system (DBMS).

Specific database permissions are needed to allow a user to create a view; for example, the user must be granted create view privileges in Oracle or SQL Server databases. With some database management systems, if you create a view on a feature class or table for which you are not the owner, you cannot grant other users' rights to the view unless the owner of the underlying tables has given you permission to grant privileges to other users.

Be aware of the following when working with database views:

Views registered with the geodatabase

If your database contains a geodatabase, you can use the Create Database View tool or SQL to create a database view, and register that view with the geodatabase using the Register With Geodatabase geoprocessing tool.

Some reasons to register a view with the geodatabase include the following:

You can include a single spatial column in the view you create if your feature class uses an SQL geometry type and if the feature class is not registered as versioned. To create a spatial view, include the spatial column and the feature class's ObjectID in the view definition and then register it.

Views that are registered with the geodatabase cannot be edited through ArcGIS clients or services.

Versioned views

Versioned views incorporate database views, stored procedures, triggers, and functions to access or edit a specified version of a table or feature class in a geodatabase using SQL.

Reasons to have versioned views include the following:

ArcGIS clients automatically create versioned views for tables and feature classes when you register them as versioned.

TipTip:

The tables or feature classes you registered as versioned in geodatabases prior to ArcGIS 10.1 did not automatically have an associated versioned view. If you have such versioned data and want a versioned view for it, you can create one by right-clicking the versioned table, feature class, or feature dataset in the ArcMap Catalog tree, pointing to Manage, and clicking Enable SQL Access.

Versioned views work with all data in an individual versioned table or feature class. You cannot use a WHERE clause to join multiple tables together or restrict which rows or columns are included in a versioned view.

The primary use of versioned views is to edit versioned data using SQL. You cannot modify the underlying table or feature class through a versioned view using an ArcGIS client application. The table or feature class upon which the versioned view is based must meet the ArcGIS requirements for editing geodatabase data with SQL.

Archive views

An archive view is a database view defined on a nonversioned, archive-enabled table or feature class. Archive views also include triggers that keep the archiving tables up-to-date when edits are made through the archive view. An archive view is created when you enable the dataset for archiving or when you enable SQL access on a nonversioned, archive-enabled dataset.

Reasons to have archive views include the following:

Archive views work with all data in an individual table or feature class. You cannot use a WHERE clause to join multiple tables together or restrict which rows or columns are included in an archive view.