ODBC scalar functions

You can use SQL scalar functions on columns of result sets, or on columns that restrict rows of a result set.

Use this syntax in a vendor escape clause to make portable scalar function calls in your SQL statements.
Read syntax diagramSkip visual syntax diagramfnscalar-function
scalar-function
Specifies any string, date and time, and system functions.
Example: You can use either of the following forms of the escape clause to call a scalar function. Both statements in this example use a vendor escape clause in the select list of a query.
  • Short-form syntax:
    SELECT {fn CONCAT(FIRSTNAME,LASTNAME)} FROM EMPLOYEE
  • Long-form syntax:
    SELECT --(*vendor(Microsoft),product(ODBC) fn CONCAT(FIRSTNAME,LASTNAME) *)--
    
    FROM EMPLOYEE
To determine which scalar functions are supported by the current server that is referenced by a specific connection handle, call SQLGetInfo() with the InfoType argument set to each of the following values:
  • SQL_NUMERIC_FUNCTIONS
  • SQL_STRING_FUNCTIONS
  • SQL_SYSTEM_FUNCTIONS
  • SQL_TIMEDATE_FUNCTIONS