Condividi tramite


STContains (tipo di dati geography)

Specifica se l'istanza geography chiamante contiene a livello spaziale l'istanza geography passata al metodo.

Sintassi

.STContains ( other_geography )

Argomenti

  • other_geography
    Altra istanza geography da confrontare con l'istanza sulla quale STContains() viene richiamato.

Tipi restituiti

SQL Server tipo restituito: bit

Tipo CLR restituito: SqlBoolean

Osservazioni

Restituisce 1 se l'istanza geography chiamante contiene a livello spaziale l'istanza geography passata al metodo; in caso contrario, restituisce 0. Restituisce null se gli identificatori SRID delle due istanze geography non sono uguali.

Esempi

Nell'esempio seguente viene utilizzato STContains() per verificare se per due istanze geography la prima contiene completamente la seconda.

DECLARE @g geography;
DECLARE @h geography;
SET @g = geography::Parse('CURVEPOLYGON (COMPOUNDCURVE (CIRCULARSTRING (-122.200928 47.454094, -122.810669 47.00648, -122.942505 46.687131, -121.14624 45.786679, -119.119263 46.183634), (-119.119263 46.183634, -119.273071 47.107523, -120.640869 47.569114, -122.200928 47.454094)))');
SET @h = geography::Parse('POINT(-121.703796 46.893985)');

SELECT @g.STContains(@h);