SQL Server CONVERTAREA Function
Updated 2024-02-13 19:17:49.403000
Description
Use the scalar function CONVERTAREA to convert to and from acres, hectares, square feet, square inches, square meters, square miles, or square yards.
Syntax
SELECT [westclintech].[wct].[CONVERTAREA] (
<@Area, float,>
,<@From_scale, nvarchar(4000),>
,<@To_scale, nvarchar(4000),>)
Arguments
@Area
is any real number. @Area is an expression of type float or of a type that can be implicitly converted to float.
@From_scale
is the description of the units @Area is being converted from. @From_scale must be a valid value as specified in area unit representations. @From_scale must be of a data type that is implicitly convertible to varchar.
@To_scale
is the description of the units @Area is being converted to. @To_scale must be a valid value as specified in area unit representations. @To_scale must be of a data type that is implicitly convertible to varchar.
Return Type
float
Remarks
Area unit representations:
| acre | acre, acres |
|---|---|
| square inches | in^2, sq in, sq ins, square inch, square inches |
| square feet | ft^2, sq ft, square foot, square feet |
| square yards | yd^2, sq yd, sq yds, square yard, square yards |
| square miles | mi^2, sq mi, sq mis, square mile, square miles |
| square meters | m^2, sq m, sq ms, square meter, square meters, square metre, square metres |
| square decimeters | dm^2, sq dm, sq dms, square decimeter, square decimeters, square decimetre, square decimeters |
| square centimeters | cm^2, sq cm, sq cms, square centimeter, square centimeters, square centimetre, square centimeters |
| square millimeters | mm^2, sq mm, sq mms, square millimeter, square millimeters, square millimetre, square millimeters |
| square microns | µm^2, sq µm, sq µms, square micron, square micron |
| square nanometers | nm^2, sq nm, sq nms, square nanometer, square nanometers, square nanometre, square nanometers |
| square picometers | pm^2, sq pm, sq pms, square picometer, square picometers, square picometre, square picometres |
| square femtometers | fm^2, sq fm, sq fms, square femtometer, square femtometers, square femtometre, square femtometres |
| square attometers | am^2, sq am, sq ams, square attometer, square attometers, square attometre, square attometres |
| square zeptometers | zm^2, sq zm, sq zms, square zeptometer, square zeptometers, square zeptometre, square zeptometres |
| square yoctometers | ym^2, sq ym, sq yms, square yoctometer, square yoctometers, square yoctometre, square yoctometres |
| square decameters | dam^2, sq dam, sq dams, square decameter, square decameters, square decametre, square decameters |
| square hectometers | , hm^2, sq hm, sq hms, square hectometer, square hectometers, square hectometre, square hectometres |
| square kilometers | km^2, sq km, sq kms, square kilometer, square kilometers, square kilometre, square kilometres |
| hectares | ha, hectare, hectares |
Examples
select wct.CONVERTAREA(1, 'acre', 'ft^2');
Here is the result set.
| column 1 |
|---|
| 43560 |