2014-11-12 3 views
1

각각 기하학 컬럼이있는 테이블이 두 개 있습니다. 하나는 각기 다른 구역에, 다른 하나는 은행 기관에 대한 테이블입니다. 나는 공간 은행을 즉시 표시 할 수 있도록 은행 계좌가있는 곳을 볼 수 있습니다. Geometry 유형으로이 작업을 수행 할 수 있습니까? 지금은 Spatial Results 탭에서 볼 수 있지만 두 개의 별개 열로 볼 수 있습니다.SQL 서버는 동시에 두 개의 서로 다른 공간 컬럼을 표시합니다.

Im은 SQL Server 2008을 사용합니다. btw.

쿼리 예 :

select a.Geometria, a.nombre, d.GeometriaD 
from dbo.AgenciaBancaria a join dbo.Distrito d on a.idDistrito = d.ID 
where d.Nombre = 'Carmen' 

답변

2

AFAIK, 단지 어떤 한 번에 하나의 공간 컬럼을 표시 할 수 있습니다 SQL Server Management Studio에서의 공간 결과 탭을 선택합니다.

두 열의 지오메트리를 겹쳐 쓰려면 쿼리에서 해당 유니온 또는 교차를 만들어야 할 수 있습니다.

SELECT a.Geometria.STIntersection(d.GeometriaD) AS Intersection 
FROM dbo.AgenciaBancaria a 
JOIN dbo.Distrito d ON a.idDistrito = d.ID 
WHERE d.Nombre = 'Carmen' 

-- The above query is just for demonstration purposes; it would possibly need some 
-- optimization to run faster, such as a fast intersection test in the WHERE clause. 

또는 STIntersectionSTUnion의 결과를 표시하는 그래픽 예 : 예를 들어

+0

확인 감사 Results of <code>STIntersection</code> and <code>STUnion</code>! 나는 그들의 노동 조합을 만들고 그것이 어떻게 가는지 볼 것입니다! –