<?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: SDE Query under SQL Server in Geodatabase Questions</title>
    <link>https://community.esri.com/t5/geodatabase-questions/sde-query-under-sql-server/m-p/1218923#M7926</link>
    <description>&lt;P&gt;Hi Vince,&lt;/P&gt;&lt;P&gt;Thank you for fast reply, really appreciated. You are right, with SQL Query Layer is working well. I didn't realize one of the table wasn't in the right Spatial Reference, so nothing was working well.&lt;/P&gt;&lt;P&gt;I recreated my table in right Spatial Reference and STWithin/STIntersects working fine.&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;Jean&lt;/P&gt;</description>
    <pubDate>Wed, 05 Oct 2022 11:49:41 GMT</pubDate>
    <dc:creator>JeanDesormeaux</dc:creator>
    <dc:date>2022-10-05T11:49:41Z</dc:date>
    <item>
      <title>SDE Query under SQL Server</title>
      <link>https://community.esri.com/t5/geodatabase-questions/sde-query-under-sql-server/m-p/1218599#M7918</link>
      <description>&lt;P&gt;Hi guys,&lt;/P&gt;&lt;P&gt;Under SQL Server 2014 registered as SDE geodatabase, is there any way to query geometries via SQL?&lt;/P&gt;&lt;P&gt;I need to select SDE geometries that are within another SDE geometry but I can't with no luck find any examples on web.&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Jean&lt;/P&gt;</description>
      <pubDate>Tue, 04 Oct 2022 13:10:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/sde-query-under-sql-server/m-p/1218599#M7918</guid>
      <dc:creator>JeanDesormeaux</dc:creator>
      <dc:date>2022-10-04T13:10:02Z</dc:date>
    </item>
    <item>
      <title>Re: SDE Query under SQL Server</title>
      <link>https://community.esri.com/t5/geodatabase-questions/sde-query-under-sql-server/m-p/1218726#M7920</link>
      <description>&lt;P&gt;&lt;A href="https://desktop.arcgis.com/en/arcmap/latest/manage-data/using-sql-with-gdbs/sql-access-to-geodatabase-data.htm" target="_blank"&gt;https://desktop.arcgis.com/en/arcmap/latest/manage-data/using-sql-with-gdbs/sql-access-to-geodatabase-data.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Oct 2022 17:44:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/sde-query-under-sql-server/m-p/1218726#M7920</guid>
      <dc:creator>MarceloMarques</dc:creator>
      <dc:date>2022-10-04T17:44:42Z</dc:date>
    </item>
    <item>
      <title>Re: SDE Query under SQL Server</title>
      <link>https://community.esri.com/t5/geodatabase-questions/sde-query-under-sql-server/m-p/1218736#M7921</link>
      <description>&lt;P&gt;An ArcGIS Query Layer will return the contents of a SQL query. That query can contain a spatial predicate, as would be valid from a query in SQL Server Management Studio.&lt;/P&gt;&lt;P&gt;If you're looking for SQL examples using Microsoft geometry and/or geography columns, you should probably be reviewing Microsoft documentation, not Esri sources (Esri hasn't supported their own geometry model in SQL Server in a decade, so there isn't really anything called an "SDE geometry" anymore).&lt;/P&gt;&lt;P&gt;The OGC "Within" operator (&lt;A href="https://learn.microsoft.com/en-us/sql/t-sql/spatial-geometry/stwithin-geometry-data-type?view=sql-server-ver16" target="_blank" rel="noopener"&gt;STWithin&lt;/A&gt;) is tricky because the definition of "within" doesn't include overlap at boundaries (you might need to use &lt;A href="https://learn.microsoft.com/en-us/sql/t-sql/spatial-geometry/stintersects-geometry-data-type?view=sql-server-ver16" target="_self"&gt;STIntersects&lt;/A&gt; then filter from there).&lt;/P&gt;&lt;P&gt;The principal limitation for a Query Layer is that you cannot return more than one geometry column; returning CLOB/NCLOB columns in the result set might be problematic, as well (depending on the release and exact query).&lt;/P&gt;&lt;P&gt;Without a concrete attempt at a query, with a description of the tables involved, it's difficult to provide a more specific response.&lt;/P&gt;&lt;P&gt;- V&lt;/P&gt;</description>
      <pubDate>Tue, 04 Oct 2022 18:16:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/sde-query-under-sql-server/m-p/1218736#M7921</guid>
      <dc:creator>VinceAngelo</dc:creator>
      <dc:date>2022-10-04T18:16:49Z</dc:date>
    </item>
    <item>
      <title>Re: SDE Query under SQL Server</title>
      <link>https://community.esri.com/t5/geodatabase-questions/sde-query-under-sql-server/m-p/1218748#M7922</link>
      <description>&lt;P&gt;here an example: I have Burial sites flagged as Limited Sales. I want to know where in the Cemetery Which Sections) So I use this query to create custom reports.&lt;/P&gt;&lt;P&gt;Is that what you were looking for?&lt;/P&gt;&lt;LI-CODE lang="sql"&gt;select SECTION_NAME, COUNT(*) as RecCount
from
(
select l.*, s.SECTION_NAME,s.SUB_SECTION_NAME,s.SUB_SUB_SECTION_NAME,s.OBJECTID as UID
from 
(select 
	OBJECTID,Shape,Name
	from COA_CEMETERY_BURIAL_SITES where Name='Limited Sale') as l
	cross JOIN
(select * from COA_CEMETERY_SECTIONS) as s
WHERE        (s.Shape.STContains(l.shape.STCentroid()) = 1)) t
group by t.SECTION_NAME&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 04 Oct 2022 18:36:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/sde-query-under-sql-server/m-p/1218748#M7922</guid>
      <dc:creator>DominicRobergeIADOT</dc:creator>
      <dc:date>2022-10-04T18:36:10Z</dc:date>
    </item>
    <item>
      <title>Re: SDE Query under SQL Server</title>
      <link>https://community.esri.com/t5/geodatabase-questions/sde-query-under-sql-server/m-p/1218754#M7923</link>
      <description>&lt;P&gt;That query doesn't return a geometry. Query Tables are also a thing, but you can't map them. If you isolated the 't' virtual table as a Query Layer, it might work.&amp;nbsp; Have you tried?&lt;/P&gt;&lt;P&gt;- V&lt;/P&gt;</description>
      <pubDate>Tue, 04 Oct 2022 18:55:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/sde-query-under-sql-server/m-p/1218754#M7923</guid>
      <dc:creator>VinceAngelo</dc:creator>
      <dc:date>2022-10-04T18:55:14Z</dc:date>
    </item>
    <item>
      <title>Re: SDE Query under SQL Server</title>
      <link>https://community.esri.com/t5/geodatabase-questions/sde-query-under-sql-server/m-p/1218772#M7924</link>
      <description>&lt;P&gt;I didn't realized he needed the geometry... this one will returns all the records&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="sql"&gt;select * from COA_CEMETERY_SECTIONS
where OBJECTID in(select UID  from
(
select l.*, s.SECTION_NAME,s.SUB_SECTION_NAME,s.SUB_SUB_SECTION_NAME,s.OBJECTID as UID
from 
(select 
	OBJECTID,Shape,Name
	from COA_CEMETERY_BURIAL_SITES where Name='Limited Sale') as l
	cross JOIN
(select * from COA_CEMETERY_SECTIONS) as s
WHERE        (s.Shape.STContains(l.shape.STCentroid()) = 1)) t
group by t.UID) &lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 04 Oct 2022 19:17:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/sde-query-under-sql-server/m-p/1218772#M7924</guid>
      <dc:creator>DominicRobergeIADOT</dc:creator>
      <dc:date>2022-10-04T19:17:32Z</dc:date>
    </item>
    <item>
      <title>Re: SDE Query under SQL Server</title>
      <link>https://community.esri.com/t5/geodatabase-questions/sde-query-under-sql-server/m-p/1218923#M7926</link>
      <description>&lt;P&gt;Hi Vince,&lt;/P&gt;&lt;P&gt;Thank you for fast reply, really appreciated. You are right, with SQL Query Layer is working well. I didn't realize one of the table wasn't in the right Spatial Reference, so nothing was working well.&lt;/P&gt;&lt;P&gt;I recreated my table in right Spatial Reference and STWithin/STIntersects working fine.&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;Jean&lt;/P&gt;</description>
      <pubDate>Wed, 05 Oct 2022 11:49:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/sde-query-under-sql-server/m-p/1218923#M7926</guid>
      <dc:creator>JeanDesormeaux</dc:creator>
      <dc:date>2022-10-05T11:49:41Z</dc:date>
    </item>
  </channel>
</rss>

