Inserting a value into a global ID or GUID column in SQL Server 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. GUIDs can be added to any layer.

Therefore, if the table you want to edit participates in replication or contains a GUID, 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 Microsoft SQL Server function newid(). If the table you are editing is versioned, use the newid() function to edit a multiversioned view of the table with SQL.

TipTip:

You can add global IDs to a feature class in the Catalog window by right-clicking the dataset and clicking Add Global IDs. The geodatabase maintains these values automatically when editing through ArcGIS.

Steps:
  1. If you are editing a versioned table, create a multiversioned view of it as described in Creating multiversioned views.
  2. Log in to SQL Server Management Studio as a user with permissions to edit the table.
  3. Open a new query window and connect to the database that contains the view to be edited.
  4. If you are editing a versioned table, create a new version, set the version, then start an edit session as described in Editing versioned data in SQL Server using multiversioned views and SQL. If you are editing a nonversioned table, proceed to the next step.
  5. Use the newid() function to populate the global ID or GUID column when you insert a record to the table.
    INSERT INTO jason.asset_mv (asset_id,globalid) 
    VALUES (57,newid())
    
  6. Close the edit session when you finish editing if you are editing through a multiversioned view. See Editing versioned data in SQL Server using multiversioned views and SQL for syntax information.

2/5/2013