Coercing Numeric Data Types

From InterBase
Jump to: navigation, search

Go Up to Coercing Data Types


To coerce one numeric data type to another, change the sqltype field in the parameter’s or select-list item’s XSQLVAR structure to the desired SQL macro data type constant. For example, the following statement assumes that <var> is a pointer to an XSQLVAR structure, and that it contains a SQL_SHORT data type to convert to SQL_LONG:

var->sqltype = SQL_LONG;
Important: Do not coerce a larger data type to a smaller one. Data can be lost in such a translation.