Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

Commit 5d13203

Browse files
Document mapping of input to output types
The original proposed that the input type is the same as the output type -- this is only mostly correct. The example of **decimal(2,0)** is especially misleading. The results in this table were experimentally established using SQL Server 2012 and 2017.
1 parent b297450 commit 5d13203

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

docs/t-sql/functions/power-transact-sql.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,18 @@ POWER ( float_expression , y )
4141
Is the power to which to raise *float_expression*. *y* can be an expression of the exact numeric or approximate numeric data type category, except for the **bit** data type.
4242

4343
## Return Types
44-
Returns the same type as submitted in *float_expression*. For example, if a **decimal**(2,0) is submitted as *float_expression*, the result returned is **decimal**(2,0).
44+
The return type depends on the input type of *float_expression*:
45+
46+
|Input type|Return type|
47+
|----------|-----------|
48+
|**float**, **real**|**float**|
49+
|**decimal(*p*, *s*)**|**decimal(38, *s*)**|
50+
|**int**, **smallint**, **tinyint**|**int**|
51+
|**bigint**|**bigint**|
52+
|**money**, **smallmoney**|**money**|
53+
|**bit**, **char**, **nchar**, **varchar**, **nvarchar**|**float**|
54+
55+
If the result does not fit in the return type, an arithmetic overflow error occurs.
4556

4657
## Examples
4758

0 commit comments

Comments
 (0)