3. Elements of SQL Statements : SQL Functions : Conversion Functions : Length of Results for Data Type Conversions
 
Share this page                  
Length of Results for Data Type Conversions
When converting decimal values to strings, the length of the result depends on the precision and scale of the decimal column.
Some functions have an optional length parameter. If this parameter is omitted, the length of the result returned by the data type conversion functions c(), char(), varchar(), nchar(), nvarchar(), and text() are as follows:
Data Type of Argument
Result Length
char
Length of operand
decimal
Depends on precision and scale of column
float & float4
11 characters; 12 characters on IEEE computers
integer1 (tinyint)
Maximum 4 characters
integer2 (smallint)
Maximum 6 characters
integer
Maximum 11 characters
integer8 (bigint)
Maximum 19 characters
nchar
2 x length of operand
nvarchar
2 x length of operand
money
20 characters
varchar
Length of operand