Inserting a value into a global ID or GUID column in Informix using SQL
Global ID and GUID data types store registry-style strings consisting of 36 characters enclosed in curly brackets. These strings uniquely identify a feature or table row within a geodatabase and across geodatabases. Global IDs are used to maintain uniqueness of records in one-way and two-way geodatabase replicas and nonversioned data used in offline maps. GUIDs can be added to any table.
If the table you want to edit participates in replication or offline mapping or contains a GUID column, you must insert a unique value to the global ID or GUID column when you insert a new record to the table using SQL. To do this, use the sde.retrieve_guid() function.
When editing a nonversioned table that is not enabled for archiving, you can insert the ID directly to the table using the sde.retrieve_guid() function. When editing a nonversioned table that is enabled for archiving, insert the ID to the table's archive view. When editing a versioned table, use the function to insert a value to the versioned view of the table.
To use this function in Informix, you must set the following parameter in the Informix ONCONFIG file:
VPCLASS jvp,num=1
After altering the ONCONFIG file, you must restart Informix for the changes to take effect.
- Log in to the database from an SQL prompt as a user with privileges to edit the table.
If you are editing through a versioned or archive view, the user must also have privileges to edit the view.
-
When inserting a record, use the retrieve_guid() function to insert the next global ID value.
INSERT INTO jason.assets (asset_id, globalid) VALUES (57, sde.retrieve_guid());
- When you have completed your edits, commit them to the database.