Condividi tramite


STDistance (tipo di dati geometry)

Si applica a: SQL Server Database SQL di Azure Istanza gestita di SQL di Azure

Restituisce la distanza più breve tra un punto in un'istanza geometry e un punto in un'altra istanza geometry.

Sintassi

  
.STDistance ( other_geometry )  

Argomenti

other_geometry
Altra istanza geometry da cui misurare la distanza rispetto all'istanza sulla quale viene richiamato STDistance(). Se other_geometry è un set vuoto, STDistance() restituisce Null.

Tipi restituiti

Tipo SQL Server restituito: float

Tipo CLR restituito: SqlDouble

Osservazioni:

STDistance() restituisce sempre Null se gli identificatori SRID delle istanze geometry non corrispondono.

Esempi

DECLARE @g geometry;  
DECLARE @h geometry;  
SET @g = geometry::STGeomFromText('POLYGON((0 0, 2 0, 2 2, 0 2, 0 0))', 0);  
SET @h = geometry::STGeomFromText('POINT(10 10)', 0);  
SELECT @g.STDistance(@h);  

Vedi anche

Panoramica degli indici spaziali
Metodi OGC sulle istanze di geometria