ArcObjects Library Reference (GeoDatabase)  

IClassSchemaEditEx.RegisterGlobalIDColumn Method

Registers this column as an Global ID with the database.

[Visual Basic .NET]
Public Sub RegisterGlobalIDColumn ( _
    ByVal columnName As String _
)
[C#]
public void RegisterGlobalIDColumn (
    string columnName
);
[C++]
HRESULT RegisterGlobalIDColumn(
  BSTR columnName
);
[C++]

Parameters

columnName [in]   columnName is a parameter of type BSTR

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Remarks

This method converts a field of type GUID to a field of type GlobalID.

The object must reference an unversioned ArcSDE feature class or table.  Use the IVersionedObject3::IsRegisteredAsVersioned property to determine if a dataset is versioned.  Additionally the dataset must not be replicated. Use the IWorkspaceReplicasAdmin2::IsReferencedByReplica method to determine if the dataset is part of a replica.

A Global ID field must not already exist on the dataset referenced by the object. Use the IClassEx::HasGlobalID property to determine if a dataset has a Global ID field.

The columnName must reference a field of type GUID in the dataset referenced by the object.  The IField::Type property can be used to determine a field type. 

There must be no duplicate values in the GUID field.   See the DataStatistics coclass for more information.

Another requirement is that the GUID field must be not nullable.  See the IField::IsNullable property for more information.  By default, GUID columns are nullable.  However, when adding a GUID column to a dataset you can specify this field be not nullable.  This is possible whether or not the dataset you are adding the new GUID field to already has populated rows.  If you add a GUID column to a popluated dataset, and set the IsNullable property of this field to be false, the GUID values will be populated with a default value of {00000000-0000-0000-0000-000000000000}.

If you have a GUID field but it is nullable, to satisfy the requirements of this method, you can simply add a new GUID field, ensure you set the IsNullable property to false, and calculate the values from your GUID field into the newly added GUID field.

Errors will be returned if any of the above requirements are not met.

See Also

IClassSchemaEditEx Interface