Partager via


STContains (type de données geography)

Spécifie si l'instance geography appelante contient spatialement l'instance geography passée à la méthode.

Syntaxe

.STContains ( other_geography )

Arguments

  • other_geography
    Autre instance geography à comparer à l'instance sur laquelle STContains() est appelé.

Types de retour

SQL Server type de retour : bit

Type de retour CLR : SqlBoolean

Notes

Retourne 1 si l'instance geography appelante contient spatialement l'instance geography passée à la méthode, et retourne 0 dans le cas contraire. Retourne null si le SRID des deux instances geography n'est pas identique.

Exemples

L'exemple suivant utilise STContains() pour tester deux instances geography afin de déterminer si la première instance contient la deuxième.

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);