English

How To: Return information on coded value domains using ArcSDE 10.x for SQL Server

Summary

With the introduction of the simplified Geodatabase Schema at ArcSDE 10, the methods used to access and extract information from the geodatabase have changed.

A useful script that provides an example of how to extract information from the XML Definition field is found in the Procedure section below. This returns Coded Value Domain information along the same lines as the following query in earlier releases.

For example:

9.3.x:

Code:
SELECT owner, DomainName, Description FROM GDB_DOMAINS;

Procedure

This same function can now be completed through a query against the 'Definition' column in the GDB_Items table:

10.x:

Code:
SELECT
Definition.value('(/GPCodedValueDomain2/Owner)[1]', 'nvarchar(max)') AS "Owner",
Definition.value('(/GPCodedValueDomain2/DomainName)[1]', 'nvarchar(max)') AS "DomainName",
codedValue.value('Code[1]', 'nvarchar(max)') AS "Code",
codedValue.value('Name[1]', 'nvarchar(max)') AS "Value"
FROM
SDE.GDB_ITEMS AS items INNER JOIN SDE.GDB_ITEMTYPES AS itemtypes
ON items.Type = itemtypes.UUID
CROSS APPLY
items.Definition.nodes
('/GPCodedValueDomain2/CodedValues/CodedValue') AS CodedValues(codedValue)
WHERE
itemtypes.Name = 'Coded Value Domain'

    Related Information