Skip to content

Instantly share code, notes, and snippets.

@steveoh
Last active March 13, 2019 16:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save steveoh/f86da860642f2d88aa5ef9474955880c to your computer and use it in GitHub Desktop.
Save steveoh/f86da860642f2d88aa5ef9474955880c to your computer and use it in GitHub Desktop.
get domain name/code/value from an SDE database
SELECT
cv_domain.value('DomainName[1]', 'nvarchar(50)') AS 'DomainName',
coded_value.value('Code[1]','nvarchar(50)') AS 'Code',
coded_value.value('Name[1]','nvarchar(50)') 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(coded_value)
CROSS APPLY
items.Definition.nodes('/GPCodedValueDomain2') AS CVDomains(cv_domain)
WHERE
itemtypes.Name = 'Coded Value Domain'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment