Contents Index BYTE_SUBSTR function [String] CEILING function [Numeric]

ASA SQL Reference
  SQL Functions
    Alphabetical list of functions

CAST function [Data type conversion]


Function 

Returns the value of an expression converted to a supplied data type.

Syntax 

CAST ( expression AS data type )

Parameters 

expression    The expression to be converted.

data type    The target data type.

Usage 

If you do not indicate a length for character string types, the database server chooses an appropriate length. If neither precision nor scale is specified for a DECIMAL conversion, the database server selects appropriate values.

Standards and compatibility 
See also 

CONVERT function [Data type conversion]

Example 

The following function ensures a string is used as a date:

CAST( '2000-10-31' AS DATE )

The value of the expression 1 + 2 is calculated, and the result cast into a single-character string.

CAST( 1 + 2 AS CHAR )

You can use the CAST function to shorten strings:

CAST( Surname AS CHAR(10) )

Contents Index BYTE_SUBSTR function [String] CEILING function [Numeric]