<?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>topic Re: Creating a View in SQL Server Enterprise Geodatabase: Returning Domain and Subtype Descriptions Instead of Codes in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/creating-a-view-in-sql-server-enterprise/m-p/1581717#M92662</link>
    <description>&lt;P&gt;You could check this out. The Oracle example has worked for me in the past. Hopefully the SQL Server example works for you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"&lt;A href="https://desktop.arcgis.com/en/arcmap/latest/manage-data/using-sql-with-gdbs/example-resolving-domain-codes-to-description-values.htm" target="_self"&gt;Example: Resolving domain codes to description values using SQL&lt;/A&gt;"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 04 Feb 2025 13:16:42 GMT</pubDate>
    <dc:creator>Bud</dc:creator>
    <dc:date>2025-02-04T13:16:42Z</dc:date>
    <item>
      <title>Creating a View in SQL Server Enterprise Geodatabase: Returning Domain and Subtype Descriptions Instead of Codes</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/creating-a-view-in-sql-server-enterprise/m-p/1581283#M92609</link>
      <description>&lt;P&gt;Hello Esri Community,&lt;/P&gt;&lt;P&gt;I’m working with a&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;Feature Class&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;in an&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;Enterprise Geodatabase&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;(SQL Server) that contains fields with&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;domains&lt;/STRONG&gt;,&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;subtypes&lt;/STRONG&gt;, and&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;attribute rules&lt;/STRONG&gt;. I’m trying to create a&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;SQL view&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;that filters records based on a domain field (Status) with values&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;(1, "Active")&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;and&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;(2, "Canceled"). The view should only return records where&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;Status = 1.&lt;/P&gt;&lt;P&gt;So far, I’ve successfully created the view, but the fields with&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;domains&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;and&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;subtypes&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;are returning the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;codes&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;(e.g.,&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;1&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;for "Active") instead of the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;descriptions&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;(e.g., "Active"). I’ve tried various approaches to retrieve the descriptions but haven’t been successful.&lt;/P&gt;&lt;H3&gt;&lt;STRONG&gt;Details&lt;/STRONG&gt;:&lt;/H3&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&gt;The&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;domains&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;and&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;subtypes&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;were created in&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;ArcGIS Pro&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;and assigned to fields in the feature class.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;The geodatabase is stored in&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;SQL Server&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;(Enterprise Geodatabase).&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;In&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;SQL Server Management Studio (SSMS)&lt;/STRONG&gt;, I can’t find the domain and subtype information in tables like&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;GDB_ITEMS,&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;GDB_ITEMTYPES, or&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;GDB_ITEMRELATIONSHIPS. However, the descriptions appear correctly in&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;ArcGIS Pro&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;when viewing the feature class attributes.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;H3&gt;&lt;STRONG&gt;What I’ve Tried&lt;/STRONG&gt;:&lt;/H3&gt;&lt;OL&gt;&lt;LI&gt;&lt;P&gt;Creating a SQL view that filters the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;Status&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;field:&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;CREATE&lt;/SPAN&gt; &lt;SPAN class=""&gt;VIEW&lt;/SPAN&gt; ActiveFeatureClass &lt;SPAN class=""&gt;AS&lt;/SPAN&gt;
&lt;SPAN class=""&gt;SELECT&lt;/SPAN&gt; &lt;SPAN class=""&gt;*&lt;/SPAN&gt;
&lt;SPAN class=""&gt;FROM&lt;/SPAN&gt; MyFeatureClass
&lt;SPAN class=""&gt;WHERE&lt;/SPAN&gt; &lt;SPAN class=""&gt;Status&lt;/SPAN&gt; &lt;SPAN class=""&gt;=&lt;/SPAN&gt; &lt;SPAN class=""&gt;1&lt;/SPAN&gt;&lt;SPAN class=""&gt;;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/DIV&gt;&lt;P&gt;This works, but the domain and subtype fields return codes instead of descriptions.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;Attempting to join the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;GDB_ITEMS&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;table to retrieve domain descriptions, but I couldn’t locate the domain and subtype information in SSMS.&lt;/P&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;H3&gt;&lt;STRONG&gt;What I Need&lt;/STRONG&gt;:&lt;/H3&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&gt;A way to create a SQL view that returns the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;descriptions&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;for domain and subtype fields instead of the codes.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;Guidance on how to access domain and subtype information stored in the geodatabase system tables in&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;SQL Server&lt;/STRONG&gt;.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;H3&gt;&lt;STRONG&gt;Additional Notes&lt;/STRONG&gt;:&lt;/H3&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&gt;The domains and subtypes are managed by the geodatabase and appear correctly in&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;ArcGIS Pro&lt;/STRONG&gt;.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;I’m using&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;ArcGIS Pro&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;and&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;SQL Server Management Studio (SSMS)&lt;/STRONG&gt;.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Any help or guidance would be greatly appreciated! Thank you in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Feb 2025 13:53:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/creating-a-view-in-sql-server-enterprise/m-p/1581283#M92609</guid>
      <dc:creator>JEMOO-01</dc:creator>
      <dc:date>2025-02-03T13:53:31Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a View in SQL Server Enterprise Geodatabase: Returning Domain and Subtype Descriptions Instead of Codes</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/creating-a-view-in-sql-server-enterprise/m-p/1581421#M92626</link>
      <description>&lt;P&gt;I'm using ArcGIS Pro 3.4.2 and a PostgreSQL relational database.&amp;nbsp; I have a trails feature class with subtypes and domains. In Postgres's equivalent of SSMS, pgadmin, if I go into the gdb_items repository table, under the definition/xml field for the database.owner.TrailsSubset row (FC is in the name column), there's a super long XML field that you have to scroll through to find the subtype code and description.&amp;nbsp; For the domains, it's another row(s) in the same table.&amp;nbsp; My domains are called Class Desc, Surface Desc, and Maintenance Desc under the name column.&amp;nbsp; The codes and description are in the XML column for those row items.&amp;nbsp; See images below.&amp;nbsp; But with all this said, not sure how to create the DBView query to access these items...&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="repository1.JPG" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/124537iD5D39C85F82F9D41/image-size/large?v=v2&amp;amp;px=999" role="button" title="repository1.JPG" alt="repository1.JPG" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="repositor2.JPG" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/124538iE0F9F7C3955FF78B/image-size/large?v=v2&amp;amp;px=999" role="button" title="repositor2.JPG" alt="repositor2.JPG" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="repositor3.JPG" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/124539i43D13B4B86451218/image-size/large?v=v2&amp;amp;px=999" role="button" title="repositor3.JPG" alt="repositor3.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Feb 2025 18:21:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/creating-a-view-in-sql-server-enterprise/m-p/1581421#M92626</guid>
      <dc:creator>Robert_LeClair</dc:creator>
      <dc:date>2025-02-03T18:21:20Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a View in SQL Server Enterprise Geodatabase: Returning Domain and Subtype Descriptions Instead of Codes</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/creating-a-view-in-sql-server-enterprise/m-p/1581675#M92658</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;SPAN&gt;Robert_LeClair,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Thank you so much for providing the example and for your help with Viewing the Location of Domains and Subtypes in pgadmin which is the same at SSMS.&lt;/P&gt;&lt;P&gt;i think all is good for extracting domain and creating tables for it so I can extract the code and description separately&amp;nbsp;&lt;BR /&gt;while creating the view there is any way to change field datatype [ having (field 1)&amp;nbsp;&lt;STRONG&gt;short&lt;/STRONG&gt; datatype while creating the view can I convert it to &lt;STRONG&gt;text&lt;/STRONG&gt;&amp;nbsp;datatype --&amp;gt; while returning the domain description, error will appear cuz it short [ accept only int ]&amp;nbsp; and I want to return text]&amp;nbsp; that's why I want to convert field datatype without any change occur in the source feature class&amp;nbsp; &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Feb 2025 08:52:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/creating-a-view-in-sql-server-enterprise/m-p/1581675#M92658</guid>
      <dc:creator>JEMOO-01</dc:creator>
      <dc:date>2025-02-04T08:52:20Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a View in SQL Server Enterprise Geodatabase: Returning Domain and Subtype Descriptions Instead of Codes</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/creating-a-view-in-sql-server-enterprise/m-p/1581717#M92662</link>
      <description>&lt;P&gt;You could check this out. The Oracle example has worked for me in the past. Hopefully the SQL Server example works for you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"&lt;A href="https://desktop.arcgis.com/en/arcmap/latest/manage-data/using-sql-with-gdbs/example-resolving-domain-codes-to-description-values.htm" target="_self"&gt;Example: Resolving domain codes to description values using SQL&lt;/A&gt;"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Feb 2025 13:16:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/creating-a-view-in-sql-server-enterprise/m-p/1581717#M92662</guid>
      <dc:creator>Bud</dc:creator>
      <dc:date>2025-02-04T13:16:42Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a View in SQL Server Enterprise Geodatabase: Returning Domain and Subtype Descriptions Instead of Codes</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/creating-a-view-in-sql-server-enterprise/m-p/1581718#M92663</link>
      <description>&lt;P&gt;If you run into problems, you could try asking on the Esri Data Management community. There are SQL Server GDB experts over there.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Feb 2025 13:19:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/creating-a-view-in-sql-server-enterprise/m-p/1581718#M92663</guid>
      <dc:creator>Bud</dc:creator>
      <dc:date>2025-02-04T13:19:32Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a View in SQL Server Enterprise Geodatabase: Returning Domain and Subtype Descriptions Instead of Codes</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/creating-a-view-in-sql-server-enterprise/m-p/1582369#M92728</link>
      <description>&lt;P&gt;You may try using SQL CASE Expression for this simple scenario&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.w3schools.com/sql/sql_case.asp" target="_self"&gt;SQL CASE Expression&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/sql/t-sql/language-elements/case-transact-sql?view=sql-server-ver16" target="_self"&gt;CASE (Transact-SQL)&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Sample1: If there is a possibility of Status field having values other than 1/2:&lt;/P&gt;&lt;LI-CODE lang="sql"&gt;CREATE VIEW ActiveFeatureClass AS
SELECT Field1, Field2, Field3, 
CASE
    WHEN Status = 1 THEN 'Active'
    WHEN Status = 2 THEN 'Canceled'
    ELSE 'Whatever message you want'
	END AS Status, Field4, Field5
FROM MyFeatureClass
WHERE Status = 1;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sample1: If the Status field has only 1/2 as values, you can use this as well:&lt;/P&gt;&lt;LI-CODE lang="sql"&gt;CREATE VIEW ActiveFeatureClass AS
SELECT Field1, Field2, Field3, 
CASE
    WHEN Status = 1 THEN 'Active'
    ELSE 'Canceled'
	END AS Status
FROM MyFeatureClass
WHERE Status = 1;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Feb 2025 17:56:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/creating-a-view-in-sql-server-enterprise/m-p/1582369#M92728</guid>
      <dc:creator>Asrujit_SenGupta</dc:creator>
      <dc:date>2025-02-05T17:56:34Z</dc:date>
    </item>
  </channel>
</rss>

