It would be helpful if we could access file geodatabase system tables using SQL. For example, provide a dynamic way to query for domain values (codes and descriptions) for a given domain.
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.
create or replace view d_atn_type as
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
where
i.name = 'ATN_TYPE'
![Bud_0-1693488944941.png Bud_0-1693488944941.png](https://community.esri.com/t5/image/serverpage/image-id/79565iE5585894F1B4F7AB/image-size/medium?v=v2&px=400)
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:
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
![Bud_1-1693488945084.png Bud_1-1693488945084.png](https://community.esri.com/t5/image/serverpage/image-id/79566iFC84647C352D62DF/image-size/medium?v=v2&px=400)
But that's not possible with file geodatabases, since we can't access the system tables via SQL.
Related (but different): File Geodatabase views should support domains