You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/t-sql/data-types/decimal-and-numeric-transact-sql.md
+7-8Lines changed: 7 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -35,16 +35,16 @@ Numeric data types that have fixed precision and scale. Decimal and numeric are
35
35
36
36
## Arguments
37
37
**decimal**[**(**_p_[**,**_s_]**)**] and **numeric**[**(**_p_[**,**_s_]**)**]
38
-
Fixed precision and scale numbers. When maximum precision is used, valid values are from - 10^38 +1 through 10^38 - 1. The ISO synonyms for **decimal** are **dec** and **dec(**_p_, _s_**)**. **numeric** is functionally equivalent to **decimal**.
38
+
Fixed precision and scale numbers. When maximum precision is used, valid values are from - 10^38 +1 through 10^38 - 1. The ISO synonyms for **decimal** are **dec** and **dec(**_p_, _s_**)**. **numeric** is functionally identical to **decimal**.
39
39
40
40
p (precision)
41
-
The maximum total number of decimal digits that will be stored, both to the left and to the right of the decimal point. The precision must be a value from 1 through the maximum precision of 38. The default precision is 18.
41
+
The maximum total number of decimal digits to be stored. This number includes both the left and the right sides of the decimal point. The precision must be a value from 1 through the maximum precision of 38. The default precision is 18.
42
42
43
43
> [!NOTE]
44
44
> Informatica only supports 16 significant digits, regardless of the precision and scale specified.
45
45
46
46
*s* (scale)
47
-
The number of decimal digits that will be stored to the right of the decimal point. This number is subtracted from *p* to determine the maximum number of digits to the left of the decimal point. Scale must be a value from 0 through *p*. Scale can be specified only if precision is specified. The default scale is 0; therefore, 0 <= *s*\<= *p*. Maximum storage sizes vary, based on the precision.
47
+
The number of decimal digits that are stored to the right of the decimal point. This number is subtracted from *p* to determine the maximum number of digits to the left of the decimal point. Scale must be a value from 0 through *p*, and can only be specified if precision is specified. The default scale is 0 and so 0 <= *s*\<= *p*. Maximum storage sizes vary, based on the precision.
48
48
49
49
|Precision|Storage bytes|
50
50
|---|---|
@@ -57,18 +57,18 @@ The number of decimal digits that will be stored to the right of the decimal poi
57
57
> Informatica (connected through the SQL Server PDW Informatica Connector) only supports 16 significant digits, regardless of the precision and scale specified.
58
58
59
59
## Converting decimal and numeric data
60
-
For the **decimal** and **numeric** data types, [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] considers each specific combination of precision and scale as a different data type. For example, **decimal(5,5)** and **decimal(5,0)** are considered different data types.
60
+
For **decimal** and **numeric** data types, [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] considers each combination of precision and scale as a different data type. For example, **decimal(5,5)** and **decimal(5,0)** are considered different data types.
61
61
62
62
In [!INCLUDE[tsql](../../includes/tsql-md.md)] statements, a constant with a decimal point is automatically converted into a **numeric** data value, using the minimum precision and scale necessary. For example, the constant 12.345 is converted into a **numeric** value with a precision of 5 and a scale of 3.
63
63
64
64
Converting from **decimal** or **numeric** to **float** or **real** can cause some loss of precision. Converting from **int**, **smallint**, **tinyint**, **float**, **real**, **money**, or **smallmoney** to either **decimal** or **numeric** can cause overflow.
65
65
66
-
By default, [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] uses rounding when converting a number to a **decimal** or **numeric** value with a lower precision and scale. However, if the SET ARITHABORT option is ON, [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] raises an error when overflow occurs. Loss of only precision and scale is not sufficient to raise an error.
66
+
By default, [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] uses rounding when converting a number to a **decimal** or **numeric** value with a lower precision and scale. Conversely, if the SET ARITHABORT option is ON, [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] raises an error when overflow occurs. Loss of only precision and scale isn't sufficient to raise an error.
67
67
68
68
When converting float or real values to decimal or numeric, the decimal value will never have more than 17 decimals. Any float value < 5E-18 will always convert as 0.
69
69
70
70
## Examples
71
-
The following example creates a table using the **decimal** and **numeric** data types. Values are inserted into each column and the results are returned by using a SELECT statement.
71
+
The following example creates a table using the **decimal** and **numeric** data types. Values are inserted into each column. The results are returned by using a SELECT statement.
Empties the database authentication cache containing information about logins and firewall rules, for the current user database in [!INCLUDE[ssSDS](../../includes/sssds-md.md)]. This statement does not apply to the logical master database, because the master database contains the physical storage for the information about logins and firewall rules. The user executing the statement and other currently connected users remain connected. (DBCC FLUSHAUTHCACHE is not currently supported for [!INCLUDE[ssSDW_md](../../includes/sssdw-md.md)].)
26
+
Empties the database authentication cache containing information about logins and firewall rules, for the current user database in [!INCLUDE[ssSDS](../../includes/sssds-md.md)]. This statement doesn't apply to the logical master database, because the master database contains the physical storage for the information about logins and firewall rules. The user executing the statement and other currently connected users remain connected. (DBCC FLUSHAUTHCACHE isn't currently supported for [!INCLUDE[ssSDW_md](../../includes/sssdw-md.md)].)
27
27
28
-
[Transact-SQL Syntax Conventions](../../t-sql/language-elements/transact-sql-syntax-conventions-transact-sql.md)
28
+
[Transact-SQL Syntax Conventions](../../t-sql/language-elements/transact-sql-syntax-conventions-transact-sql.md)
29
29
30
30
## Syntax
31
31
@@ -37,8 +37,8 @@ DBCC FLUSHAUTHCACHE [ ; ]
37
37
None.
38
38
39
39
## Remarks
40
-
The authentication cache makes a copy of logins and server firewall rules that are stored in master and places them in memory in the user database. Since information about contained database users are already stored in the user database, contained database users are not part of the authentication cache.
41
-
Continuously active connections to [!INCLUDE[ssSDS](../../includes/sssds-md.md)] require reauthorization (performed by the [!INCLUDE[ssDE](../../includes/ssde-md.md)]) at least every 10 hours. The [!INCLUDE[ssDE](../../includes/ssde-md.md)] attempts reauthorization using the originally submitted password and no user input is required. For performance reasons, when a password is reset in [!INCLUDE[ssSDS](../../includes/sssds-md.md)], the connection will not be re-authenticated, even if the connection is reset due to connection pooling. This is different from the behavior of on-premises [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)]. If the password has been changed since the connection was initially authorized, the connection must be terminated and a new connection made using the new password. A user with the KILL DATABASE CONNECTION permission can explicitly terminate a connection to [!INCLUDE[ssSDS](../../includes/sssds-md.md)] by using the [KILL (Transact-SQL)](../../t-sql/language-elements/kill-transact-sql.md) command.
40
+
The authentication cache makes a copy of logins and server firewall rules stored in master, and places them in memory in the user database. Since information about contained database users is already stored in the user database, contained database users aren't part of the authentication cache.
41
+
Continuously active connections to [!INCLUDE[ssSDS](../../includes/sssds-md.md)] require reauthorization (performed by the [!INCLUDE[ssDE](../../includes/ssde-md.md)]) at least every 10 hours. The [!INCLUDE[ssDE](../../includes/ssde-md.md)] attempts reauthorization using the originally submitted password and no user input is required. For performance reasons, when a password is reset in [!INCLUDE[ssSDS](../../includes/sssds-md.md)], the connection won't be reauthenticated, even if the connection is reset because of connection pooling. This behavior is different from the behavior of on-premises [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)]. If the password has changed since the connection was initially authorized, the connection must be terminated and a new connection made using the new password. A user with the KILL DATABASE CONNECTION permission can explicitly terminate a connection to [!INCLUDE[ssSDS](../../includes/sssds-md.md)] by using the [KILL (Transact-SQL)](../../t-sql/language-elements/kill-transact-sql.md) command.
42
42
43
43
## Permissions
44
44
Requires the [!INCLUDE[ssSDS](../../includes/sssds-md.md)] admin account.
SOME or ANY returns **TRUE** when the comparison specified is TRUE for any pair (_scalar_expression_**,**_x_) where *x* is a value in the single-column set; otherwise, returns **FALSE**.
59
59
60
60
## Remarks
61
-
SOME requires the *scalar_expression* to compare positively to at least one value returned by the subquery. For statements that require the *scalar_expression* to compare positively to every value that is returned by the subquery, see [ALL (Transact-SQL)](../../t-sql/language-elements/all-transact-sql.md). For instance, if the subquery returns values of 2 and 3, *scalar_expression* = SOME (subquery) would evaluate as TRUE for a *scalar_express* of 2. If the subquery returns values of 2 and 3, *scalar_expression* = ALL (subquery) would evaluate as FALSE, because some of the values of the subquery (the value of 3) would not meet the criteria of the expression.
61
+
SOME requires the *scalar_expression* to compare positively to at least one value returned by the subquery. For statements that require the *scalar_expression* to compare positively to every value that is returned by the subquery, see [ALL (Transact-SQL)](../../t-sql/language-elements/all-transact-sql.md). For instance, if the subquery returns values of 2 and 3, *scalar_expression* = SOME (subquery) would evaluate as TRUE for a *scalar_express* of 2. If the subquery returns values of 2 and 3, *scalar_expression* = ALL (subquery) would evaluate as FALSE, because some of the values of the subquery (the value of 3) wouldn't meet the criteria of the expression.
62
62
63
63
## Examples
64
64
@@ -84,7 +84,7 @@ ELSE
84
84
PRINT 'FALSE' ;
85
85
```
86
86
87
-
The following query returns `FALSE` because `3`is not less than all of the values in the table.
87
+
The following query returns `FALSE` because `3`isn't less than all of the values in the table.
88
88
89
89
```
90
90
IF 3 < ALL (SELECT ID FROM T1)
@@ -110,13 +110,13 @@ IF
110
110
ON Sales.SalesOrderDetail.ProductID = Production.Product.ProductID
111
111
WHERE SalesOrderID = @OrderID
112
112
)
113
-
PRINT 'At least one item for this order cannot be manufactured in specified number of days.'
113
+
PRINT 'At least one item for this order can't be manufactured in specified number of days.'
114
114
ELSE
115
115
PRINT 'All items for this order can be manufactured in the specified number of days or less.' ;
116
116
117
117
```
118
118
119
-
To test the procedure, execute the procedure by using the `SalesOrderID``49080`, which has one component that requires `2` days and two components that require 0 days. The first statement meets the criteria. The second query does not.
119
+
To test the procedure, execute the procedure by using the `SalesOrderID``49080`, which has one component that requires `2` days and two components that require 0 days. The first statement meets the criteria. The second query doesn't.
The OGC type of the **geometry** instance returned by `STGeomCollFromWKB()` is set to **GeomCollection**, **MultiPolygon**, **MultiLineString**, or **MultiPoint**, depending on the corresponding WKB input.
48
48
49
-
This method will throw a FormatException exception if the input is not well-formatted.
49
+
This method will throw a FormatException exception if the input isn't well-formatted.
50
50
51
51
## Examples
52
52
The following example uses `STGeomCollFromWKB()` to create a **geometry** instance.
0 commit comments