Scale of SQL data types

The scale of a numeric column or parameter refers to the maximum number of digits to the right of the decimal point. For approximate floating-point number columns or parameters, the scale is undefined because the number of digits to the right of the decimal place is not fixed.

The following table defines the scale for each SQL data type

Table 1. Scale of SQL data types
fSqlType Scale
  • SQL_CHAR
  • SQL_VARCHAR
  • SQL_LONGVARCHAR
  • SQL_CLOB
Not applicable.
  • SQL_DECIMAL
  • SQL_NUMERIC
The defined number of digits to the right of the decimal place. For example, the scale of a column defined as NUMERIC(10,3) is 3.
  • SQL_SMALLINT
  • SQL_INTEGER
  • SQL_BIGINT
0
SQL_DECFLOAT Not applicable.
  • SQL_REAL
  • SQL_FLOAT
  • SQL_DOUBLE
Not applicable.
SQL_ROWID Not applicable.
  • SQL_BINARY
  • SQL_VARBINARY
  • SQL_LONGVARBINARY
  • SQL_BLOB
Not applicable.
  • SQL_TYPE_DATE
  • SQL_TYPE_TIME
Not applicable.
SQL_TYPE_TIMESTAMP Start of changeThe number of digits to the right of the decimal point in the #yyyy-mm-dd hh:mm:ss[ffffffffffff]” format. End of change For example, if the TIMESTAMP data type uses the "yyyy-mm-dd hh:mm:ss.fff” format, the scale is 3. Start of changeThe maximum for fractional seconds is 12 digits.End of change You can retrieve the scale through the pibScale argument of SQLDescribeCol().
  • SQL_GRAPHIC
  • SQL_VARGRAPHIC
  • SQL_LONGVARGRAPHIC
  • SQL_DBCLOB
Not applicable.
SQL_XML 0