AnsweredAssumed Answered

Select by location giving unexpected results when selecting from a query layer

Question asked by Larry_McEvoy on May 31, 2019
Latest reply on May 31, 2019 by mvolz47

Hi I am trying to replicate a workflow that I had in ArcMAP 10.2.2 using ArcGIS Pro 2.3.3, I have a table with native SQL geometry stored in SQL server 2008 10.0.6241.0. I load this table up as a query layer I then need to select all the polygons from this query layer contained within a geometry stored in a SDE versioned feature class (located on the same SQL server with the geometry also stored in native SQL server format). This works perfectly in arcmap 10.2.2 using the select by location tool. When I try the same process in PRO the resulting selection appears to be random with some polygons 10's of km's outside of the selecting polygon. I can apply a definition query which visually returns the right results using this SQL Syntax  

                 ref in (select rtrim(ref)from databasename.databaseuser.querylayertablename a

                 inner join (select shape from databasename.databaseuser.selectingtablemultiversionedview_EVW                  where id=17) b

                 on a.geom.STIntersects(b.Shape)=1)

(this also works in SQL Server Management Studio) unfortunately although the visual representation is correct, the attribute table fails to open as it errors with a Failed to parse the where clause error.

Anybody else experience a similar issue or aware of a fix?