ArcGIS Desktop

  • Documentation
  • Support

  • My Profile
  • Help
  • Sign Out
ArcGIS Desktop

ArcGIS Online

The mapping platform for your organization

ArcGIS Desktop

A complete professional GIS

ArcGIS Enterprise

GIS in your enterprise

ArcGIS for Developers

Tools to build location-aware apps

ArcGIS Solutions

Free template maps and apps for your industry

ArcGIS Marketplace

Get apps and data for your organization

  • Documentation
  • Support
Esri
  • Sign In
user
  • My Profile
  • Sign Out

ArcMap

  • Home
  • Get Started
  • Map
  • Analyze
  • Manage Data
  • Tools
  • Extensions

Example: Finding domain owners using SQL

You can use SQL to find the owners of all domains in a geodatabase by querying the tables GDB_ItemTypes and GDB_Items (or GDB_Items_vw view in Oracle).

The following examples show how to extract a value from a specific XML document using an XPath expression to find the owners of all domains in a specific geodatabase.

Be sure to connect to the correct database before executing this query.

--SQL Server
SELECT items.Name AS "Domain Name",
 items.Definition.value('(/*/Owner)[1]','nvarchar(max)') AS "Owner"
FROM dbo.GDB_ITEMS AS items INNER JOIN dbo.GDB_ITEMTYPES AS itemtypes
ON items.Type = itemtypes.UUID
WHERE itemtypes.Name IN ('Coded Value Domain', 'Range Domain')

--PostgreSQL
SELECT items.name AS "Domain Name",
 (xpath('//Owner/text()', definition))[1]::text as "Owner"
FROM sde.gdb_items AS items INNER JOIN sde.gdb_itemtypes AS itemtypes
ON items.type = itemtypes.uuid
WHERE itemtypes.name IN ('Coded Value Domain', 'Range Domain');

--Oracle
SELECT	items.name AS domain_name, 
	EXTRACTVALUE(xmltype(items.definition), '*/Owner') Owner,
	itemtypes.Name AS domain_type
FROM sde.gdb_items_vw items INNER JOIN sde.gdb_itemtypes itemtypes
ON items.Type = itemtypes.UUID
WHERE itemtypes.Name IN ('Coded Value Domain', 'Range Domain');

ArcGIS Desktop

  • Home
  • Documentation
  • Support

ArcGIS Platform

  • ArcGIS Online
  • ArcGIS Desktop
  • ArcGIS Enterprise
  • ArcGIS for Developers
  • ArcGIS Solutions
  • ArcGIS Marketplace

About Esri

  • About Us
  • Careers
  • Insiders Blog
  • User Conference
  • Developer Summit
Esri
Tell us what you think.
© Copyright 2016 Environmental Systems Research Institute, Inc. | Privacy | Legal