ArcGIS Desktop

  • ArcGIS Pro
  • ArcMap

  • 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 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: Find domain owners using SQL

You can use SQL to find the owners of all domains in a geodatabase by querying the geodatabase system tables GDB_ItemTypes and GDB_Items.

The following examples show how to extract a value from a specific XML document to find the owners of all domains in a specific geodatabase in SQL Server or PostgreSQL.

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');

ArcGIS Desktop

  • Home
  • Documentation
  • Support

ArcGIS

  • ArcGIS Online
  • ArcGIS Desktop
  • ArcGIS Enterprise
  • ArcGIS
  • ArcGIS Developer
  • ArcGIS Solutions
  • ArcGIS Marketplace

About Esri

  • About Us
  • Careers
  • Esri Blog
  • User Conference
  • Developer Summit
Esri
Tell us what you think.
Copyright © 2021 Esri. | Privacy | Legal