![]() | ![]() |
Home |
|
|
Reference Manual |
|
| Chapter 1: System and User-Defined Datatypes |
|
| Converting One Datatype to Another |
Many conversions from one datatype to another are handled automatically by Adaptive Server. These are called implicit conversions. Other conversions must be performed explicitly with the convert, inttohex, and hextoint functions. See "Datatype Conversion Functions" in Chapter 2, "Transact-SQL Functions," for details about datatype conversions supported by Adaptive Server.
Only columns with variable-length datatypes can store null values. When you create a NULL column with a fixed-length datatype, Adaptive Server automatically converts it to the corresponding variable-length datatype. Adaptive Server does not inform the user of the datatype change.
Table 1-4 lists the fixed- and variable-length datatypes to which they are converted. Certain variable-length datatypes, such as moneyn, are reserved datatypes; you cannot use them to create columns, variables, or parameters:
Original Fixed-Length Datatype | Converted To |
|---|---|
char | varchar |
nchar | nvarchar |
binary | varbinary |
datetime | datetimn |
float | floatn |
int, smallint, and tinyint | intn |
decimal | decimaln |
numeric | numericn |
money and smallmoney | moneyn |
The arithabort option determines how Adaptive Server behaves when an arithmetic error occurs. The two arithabort options, arithabort arith_overflow and arithabort numeric_truncation, handle different types of arithmetic errors. You can set each option independently, or set both options with a single set arithabort on or set arithabort off statement.
If you set arithabort arith_overflow off, Adaptive Server aborts the statement that causes the error, but continues to process other statements in the transaction or batch.
The arithignore option determines whether Adaptive Server prints a warning message after an overflow error. By default, the arithignore option is turned off. This causes Adaptive Server to display a warning message after any query that results in numeric overflow. To ignore overflow errors, use set arithignore on.
Note: , The arithabort and arithignore options were redefined for release 10.0. If you use these options in your applications, examine them to be sure they still produce the desired effects.
|
|