CollectionAggregate (geometry 資料類型)
適用於:SQL Server
Azure SQL 資料庫 Azure SQL 受控執行個體
從一組 geometry 類型建立 GeometryCollection 執行個體。
Syntax
CollectionAggregate ( geometry_operand )
注意
若要檢視 SQL Server 2014 (12.x) 和更早版本的 Transact-SQL 語法,請參閱舊版文件。
引數
geometry_operand
這是 geometry 類型資料表資料行,代表一組要在 GeometryCollection 執行個體中列出的 geometry 物件。
傳回型別
SQL Server 傳回類型:geometry
例外狀況
輸入的值無效時,會擲回 FormatException
。 請參閱 STIsValid (geometry 資料類型)
備註
當輸入是空的或輸入具有不同 SRID 時,此方法會傳回 null。 請參閱空間參考識別碼 (SRID)
此方法會忽略 null 輸入。
注意
如果所有輸入的值都為 null,此方法就會傳回 null。
範例
下列範例會傳回包含 GeometryCollection
和 CurvePolygon
的 Polygon
執行個體。
-- Setup table variable for CollectionAggregate example
DECLARE @Geom TABLE
(
shape geometry,
shapeType nvarchar(50)
)
INSERT INTO @Geom(shape,shapeType) VALUES('CURVEPOLYGON(CIRCULARSTRING(2 3, 4 1, 6 3, 4 5, 2 3))', 'Circle'),
('POLYGON((1 1, 4 1, 4 5, 1 5, 1 1))', 'Rectangle');
-- Perform CollectionAggregate on @Geom.shape column
SELECT geometry::CollectionAggregate(shape).ToString()
FROM @Geom;
另請參閱
意見反映
https://aka.ms/ContentUserFeedback。
即將推出:我們會在 2024 年淘汰 GitHub 問題,並以全新的意見反應系統取代並作為內容意見反應的渠道。 如需更多資訊,請參閱:提交及檢視以下的意見反映: