Progress
SQL-92
Guide and Reference


CONVERT Function (Progress Extension)

Converts an expression to another data type. The first argument is the target data type. The second argument is the expression to be converted to that type.

The length option for the data_type argument specifies the length for conversions to CHAR and VARCHAR data types. If omitted, the default is 30 bytes.

If the expression evaluates to null, the result of the function is null.

The CONVERT function syntax is similar to but not compatible with the ODBC CONVERT function. Enclose the function in the ODBC escape clause { fn } to specify ODBC-compliant syntax. See the ODBC compatible CONVERT function for more information.

SYNTAX

CONVERT ( ’data_type [ ( length ) ]’, expression ) 

EXAMPLE

The following SQL example uses the CONVERT function to convert an INTEGER field from a system table to a character string:

SELECT CONVERT(’CHAR’, fld), fld FROM sysprogress.syscalctable;
 
CONVERT(CHAR,FLD)                FLD
-----------------                --- 
100                              100
 
1 record selected
 
 
SELECT CONVERT(’CHAR(35)’, fld), fld FROM sysprogress.syscalctable;
 
CONVERT(CHAR(35),FLD)                FLD
---------------------                --- 
100                                  100
 
1 record selected 

NOTE

COMPATIBILITY

Progress Extension


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095