Explicit Data Type Conversion


In BBj 7.0 and higher, the BBj SQL engine provides two explicit data type conversion functions shown in the table below.

Function

Description

CONVERT(value-exp, data-type)

Converts the specified value expression to the specified data type and returns that value.

CAST(value-exp AS data-type)

Casts the specified value expression to the specified data type and returns that value.

Example

SELECT CAST(my_date AS SQL_CHAR) FROM my_table

SELECT CONVERT(my_char, SQL_INTEGER) FROM my_table



______________________________________________________________________________________

Copyright BASIS International Ltd. BBj®, Visual PRO/5®, PRO/5®, and BBx® are registered trademarks.