To register a table with ArcSDE, it must meet at least the following criteria:
- It must be owned by the user registering the table.
- It can only contain one column of a user-defined type.
- It must have an integer, unique, NOT NULL column suitable as a registered row ID column. (If the table does not already contain such a column, a column is created that meets these criteria during registration with ArcSDE.)
If you register the table as a feature class, it must meet these additional criteria:
- It must have a single geometry column.
- It must have a single type of geometry (points, lines, or polygons), though individual geometries can be multipart.
Row ID columns
As mentioned in the preceding requirements, the row ID column does not have to exist before you register the table with ArcSDE. However, it is best to include a NOT NULL, integer column to be used as the row ID as part of the table's original definition and add a unique index to it or, at least, add the row ID column before data is inserted into the table.
If you must add the row ID column to a table that already contains data, ensure that the column is populated with unique integer values.
If you decide to use an existing column, it is also best if there is no existing data in the table. Repopulating the ID column either because it contained null values or because it contained nonunique values is an expensive process, especially if the table contains more than 100,000 records. Be aware, too, that in certain circumstances, the values in the column could be repopulated automatically by ArcSDE when you register the table. See the section
Using an existing column as an ArcSDE maintained row ID for these circumstances.
When you register a nonspatial table with ArcSDE using the sdetable command, there are three options for the maintenance of the row ID column values: NONE, USER, and SDE. NONE means no row ID column is defined for the table. USER indicates you (or the third-party application) maintain the values in the row ID column, and SDE means the values in the row ID column are maintained by ArcSDE. Having a row ID that contains values automatically supplied by ArcSDE helps to ensure that each of the rows is uniquely identified. If you want to use the data with ArcGIS Desktop, it is recommended that the row ID column be registered as ArcSDE maintained. For a row ID column to be registered as ArcSDE maintained, it must be an integer type and contain only unique values; it cannot contain null values.
When you register a spatial table with ArcSDE using the sdelayer command, there are two options for the maintenance of the row ID column values: USER and SDE. SQL types require the presence of a row ID column, so NONE is not a viable option with sdelayer –o register. The USER and SDE options indicate the same things as they do with nonspatial tables, as discussed in the previous paragraph.
Be aware that if you register the row ID column in a spatial table as user maintained and subsequently register the feature class with the geodatabase, ArcGIS will add an additional row ID column, object_ID. ArcGIS will maintain the values of this column.
Creating an ArcSDE maintained row ID column
If the row ID column does not exist when the table is registered, ArcSDE adds a column of type INTEGER, with a NOT NULL constraint. If the table contains rows, ArcSDE populates the column with unique ascending values starting at your specified minimum ID value. The minimum ID value defaults to 1 if you do not specify one. It then creates a unique index on the column R<registration_id>_SDE_ROWID_UK, where registration_id is the registration identifier ArcSDE assigns the table when it is registered.
ArcSDE creates a sequence generator, R<registration_id>, and uses it to generate the next value of the row ID column whenever a value is added to the column.
Using an existing column as an ArcSDE maintained row ID
If the row ID column already exists, ArcSDE confirms that the column was defined as an integer. If the column is not an integer type, the registration fails.
Next, ArcSDE confirms that the column has a unique index. If the column was defined with a nonunique index, ArcSDE drops the index and attempts to create a unique index on the column. If the index creation fails because the column contains nonunique values, ArcSDE repopulates the column with ascending values beginning at 1 and creates the unique index. ArcSDE names the unique index R<registration_id>_SDE_ROWID_UK.
Next, ArcSDE verifies that the column has been defined as NOT NULL. If the column was defined as NULL, ArcSDE attempts to redefine it as NOT NULL. If this action fails because there are null records present in the table, ArcSDE repopulates the column and defines it as NOT NULL.
Registering a spatial table with ArcSDE creates a feature class and adds records for the table in the LAYERS and TABLE_REGISTRY system tables, a record for the spatial column in the GEOMETRY_COLUMNS system table, and one record for each column in the table to the COLUMN_REGISTRY system table. (These are the sde_layers, sde_table_registry, sde_geometry_columns, and sde_column_registry tables in SQL Server and PostgreSQL.) Registering the table with ArcSDE as a feature class allows you to view the data in ArcGIS Desktop and register the feature class as versioned. Spatial queries can be performed against the feature class if a spatial index has been created on it.
Registering nonspatial tables adds a record for the table in the TABLE_REGISTRY system table and one record for each column in the table to the COLUMN_REGISTRY system table. Registering the table with ArcSDE allows you to view and select the data in ArcGIS Desktop, perform nonversioned edits, and register the table as versioned.
To register a nonspatial table (one that does not contain a geometry field) with ArcSDE, use the sdetable command with the register operation. The basic syntax to register the table with ArcSDE is as follows:
sdetable –o register –t <table_name>
[(–c <row_id_column> –C {SDE | USER| NONE}]
[–M <minimum_row_id>] [–S <table_description>]
[–k <configuration_keyword>] [–i <service>]
[–s <server_name>] [–D <database>] –u <database_user>
NOTE: You do not have to register nonspatial tables with ArcSDE before registering them with the geodatabase. However, if you do not register a table with ArcSDE, the table cannot be edited.
To register a table containing a spatial column with ArcSDE, use the sdelayer command with the register operation. The following is the syntax to register a layer with ArcSDE:
sdelayer –o register –l <table_name,spatial_column_name> –e <entity_mask>
{[–C <row_id_column>[,{SDE | USER}[,<minimum_row_id>]]]}
[{–R <spatial_reference_id> | [Spatial_Ref_Options]}] [–k <configuration_keyword>]
[–t <storage_type>] [–S <layer_description_str>]
[–i <service>] [–s <server_name>] [–D <database>]
–u <database_user> –p <database_user_password>
Where [Spatial_Ref_Options] include
[-x <xoffset,yoffset,xyscale[,xyClusterTol]>]
[-z <zoffset,zscale[,zClusterTol]>] [-m <moffset,mscale[,mClusterTol]>]
[-G {<projection_ID> | file=<proj_file_name>}]
Options in square brackets, [], are optional depending on your situation.
As stated in the previous section, if you do not specify the row ID column, ArcSDE creates one for you to use. If you do specify an existing row ID column and want the geodatabase to use that same column as the object ID, be sure to specify SDE with the –C option.
Only the owner of the table can register it, so the database user specified with the –u option should be the user who owns the table.
NOTE: For instructions on using the sdetable or sdelayer commands, see the ArcSDE Administration Command Reference provided with the ArcSDE component of ArcGIS Server Enterprise.
Registering a table or feature class with the geodatabase adds a record to the GDB_OBJECTCLASSES system table. Registering a feature class also adds a record to the GDB_FEATURECLASSES system table.
In addition, registering a feature class or table with the geodatabase adds an ObjectID field to the table. This field is populated by the geodatabase with unique ID numbers.
If you register a nonspatial table with the geodatabase and the table already contains an ObjectID field, you are presented with a dialog box that allows you to use the existing field or add a new field, ObjectID_1.
NOTE: If you choose to use the existing field, be aware that any existing values in the field will be overwritten.
If you register with the geodatabase a feature class that already contains a field named ObjectID, an ID field is automatically added to the business table. This ID field's
data type is Object ID. The field is populated with unique values for each record in the business table. These values are generated by the geodatabase.
Be aware that there can be only one field with a data type of Object ID in a feature class registered with the geodatabase. If the existing ObjectID field was registered with ArcSDE as a user-maintained ObjectID, the data type on the existing ObjectID field will be changed to Long Integer. If the existing ObjectID field was registered with ArcSDE as ArcSDE maintained, the existing ObjectID will be used for the ObjectID.
NOTE: Because ArcGIS cannot add an ObjectID field to a view nor update the values in an existing ObjectID field in a view, you cannot register a view with the geodatabase.
To register a nonspatial table or a feature class with the geodatabase in ArcCatalog, follow these steps:
- Start ArcCatalog.
- Right-click the table or feature class you want to register with the geodatabase.
- Click Register with Geodatabase.
- If you are registering a nonspatial table that already contains an ObjectID field, choose either to use the existing field to store ObjectIDs or create a new field. Click OK.
Once the dataset is registered with the geodatabase, you can use functionality such as relationship class participation, adding subtypes to it, and using domains with it. In addition, for feature classes, you can move them into a feature dataset so the feature class can be used in topologies, networks, terrains, and other feature dataset constructs. (To use functionality such as network datasets, terrains, schemas, and cadastral fabrics, you must have the required ArcGIS extension installed and enabled.)
NOTE: You cannot copy and paste the feature class into a feature dataset in the same geodatabase; you must move it into the feature dataset by dragging it. Copying the feature class would create a second feature class with the same name. Since feature class names must be unique in the geodatabase, copying the feature class fails. Also, remember that both the feature dataset and the feature class that is added to it must be owned by the same user.