STArea (geometry Data Type)
Applies to: SQL Server Azure SQL Database Azure SQL Managed Instance SQL analytics endpoint in Microsoft Fabric Warehouse in Microsoft Fabric
Returns the total surface area of a geometry instance.
Syntax
.STArea ( )
Note
To view Transact-SQL syntax for SQL Server 2014 (12.x) and earlier versions, see Previous versions documentation.
Return Types
SQL Server return type: float
CLR return type: SqlDouble
Remarks
STArea()
returns 0 if a geometry instance contains only 0- and 1-dimensional figures, or if it is empty. STArea()
returns NULL if the geometry instance has not been initialized.
Examples
A. Computing the area of a Polygon instance
The following example creates a Polygon``geometry
instance and computes the area of the polygon.
DECLARE @g geometry;
SET @g = geometry::STGeomFromText('POLYGON((0 0, 3 0, 3 3, 0 3, 0 0),(2 2, 2 1, 1 1, 1 2, 2 2))', 0);
SELECT @g.STArea();
B. Computing the area of a CurvePolygon instance
The following example computes the area of a CurvePolygon
instance.
DECLARE @g geometry;
SET @g = geometry::Parse('CURVEPOLYGON(CIRCULARSTRING(0 2, 2 0, 4 2, 4 2, 0 2))');
SELECT @g.STArea() AS Area;
See Also
คำติชม
https://aka.ms/ContentUserFeedback
เร็วๆ นี้: ตลอดปี 2024 เราจะขจัดปัญหา GitHub เพื่อเป็นกลไกคำติชมสำหรับเนื้อหา และแทนที่ด้วยระบบคำติชมใหม่ สำหรับข้อมูลเพิ่มเติม ให้ดู:ส่งและดูข้อคิดเห็นสำหรับ