<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>idea Access FGDB system tables using SQL in ArcGIS Pro Ideas</title>
    <link>https://community.esri.com/t5/arcgis-pro-ideas/access-fgdb-system-tables-using-sql/idi-p/1324335</link>
    <description>&lt;P&gt;It would be helpful if we could access file geodatabase system tables using SQL.&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;For example, provide a &lt;U&gt;&lt;EM&gt;dynamic&lt;/EM&gt;&lt;/U&gt; way to query for domain values (codes and descriptions) for a given domain.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;We can do it in enterprise geodatabases like Oracle EGDBs. What I do is create individual views to get the domain values (codes and descriptions) for a given domain.&lt;/P&gt;&lt;PRE&gt;create or replace view &lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;d&lt;/STRONG&gt;&lt;/FONT&gt;_atn_type as&lt;BR /&gt;select      
    cast(rownum as number(38,0)) as rownum_,
    x.code,
    x.description,
    i.name as domain_name
from        
    sde.gdb_items_vw i
cross apply xmltable(
    '/GPCodedValueDomain2/CodedValues/CodedValue' 
    passing xmltype(i.definition)
    columns
        code        varchar2(255) path './Code',
        description varchar2(255) path './Name'
    ) x    
&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;where      
    i.name = 'ATN_TYPE'&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Bud_0-1693488944941.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/79565iE5585894F1B4F7AB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Bud_0-1693488944941.png" alt="Bud_0-1693488944941.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then in a query/view where I'm selecting data from an EGDB table or FC, I join from the field that has the domain code to the domain view to get the domain description:&lt;/P&gt;&lt;PRE&gt;select
    objectid,
    atn_id,
    type as type_code,
    d.description as type_description
from
    infrastr.active_transportation a
left join
    infrastr.d_atn_type_vw d
    on a.type = d.code&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Bud_1-1693488945084.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/79566iFC84647C352D62DF/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Bud_1-1693488945084.png" alt="Bud_1-1693488945084.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But that's not possible with file geodatabases, since we can't access the system tables via SQL.&lt;/P&gt;&lt;P&gt;Related (but different):&amp;nbsp;&lt;A href="https://community.esri.com/t5/arcgis-pro-ideas/file-geodatabase-views-should-support-domains/idc-p/1314737" target="_self"&gt;File Geodatabase views should support domains&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 31 Aug 2023 13:41:18 GMT</pubDate>
    <dc:creator>Bud</dc:creator>
    <dc:date>2023-08-31T13:41:18Z</dc:date>
    <item>
      <title>Access FGDB system tables using SQL</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/access-fgdb-system-tables-using-sql/idi-p/1324335</link>
      <description>&lt;P&gt;It would be helpful if we could access file geodatabase system tables using SQL.&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;For example, provide a &lt;U&gt;&lt;EM&gt;dynamic&lt;/EM&gt;&lt;/U&gt; way to query for domain values (codes and descriptions) for a given domain.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;We can do it in enterprise geodatabases like Oracle EGDBs. What I do is create individual views to get the domain values (codes and descriptions) for a given domain.&lt;/P&gt;&lt;PRE&gt;create or replace view &lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;d&lt;/STRONG&gt;&lt;/FONT&gt;_atn_type as&lt;BR /&gt;select      
    cast(rownum as number(38,0)) as rownum_,
    x.code,
    x.description,
    i.name as domain_name
from        
    sde.gdb_items_vw i
cross apply xmltable(
    '/GPCodedValueDomain2/CodedValues/CodedValue' 
    passing xmltype(i.definition)
    columns
        code        varchar2(255) path './Code',
        description varchar2(255) path './Name'
    ) x    
&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;where      
    i.name = 'ATN_TYPE'&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Bud_0-1693488944941.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/79565iE5585894F1B4F7AB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Bud_0-1693488944941.png" alt="Bud_0-1693488944941.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then in a query/view where I'm selecting data from an EGDB table or FC, I join from the field that has the domain code to the domain view to get the domain description:&lt;/P&gt;&lt;PRE&gt;select
    objectid,
    atn_id,
    type as type_code,
    d.description as type_description
from
    infrastr.active_transportation a
left join
    infrastr.d_atn_type_vw d
    on a.type = d.code&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Bud_1-1693488945084.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/79566iFC84647C352D62DF/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Bud_1-1693488945084.png" alt="Bud_1-1693488945084.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But that's not possible with file geodatabases, since we can't access the system tables via SQL.&lt;/P&gt;&lt;P&gt;Related (but different):&amp;nbsp;&lt;A href="https://community.esri.com/t5/arcgis-pro-ideas/file-geodatabase-views-should-support-domains/idc-p/1314737" target="_self"&gt;File Geodatabase views should support domains&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Aug 2023 13:41:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/access-fgdb-system-tables-using-sql/idi-p/1324335</guid>
      <dc:creator>Bud</dc:creator>
      <dc:date>2023-08-31T13:41:18Z</dc:date>
    </item>
  </channel>
</rss>

