Supported string functions

Last modified: July 7, 2025

The driver supports the following data types and string manipulation functions.

Supported data types

  • string_exp – The string expression can be a column name, a character-string literal, or the result of another scalar function. The underlying data type can be SQL_CHAR, SQL_VARCHAR, or SQL_LONGVARCHAR.
  • character_exp – The character expression represents a variable-length character string.
  • start, length, count – The numeric parameters can be a numeric literal or the result of another scalar function. The underlying data type can be SQL_TINYINT, SQL_SMALLINT, or SQL_INTEGER.

String functions

Function ODBC Version Description
ASCII( string_exp ) 1.0 Returns the ASCII code value of the leftmost character as an integer.
BIT_LENGTH( string_exp ) 3.0 Returns the length of the string expression in bits. Provides the raw bit-length of the data without string type conversion.
CHAR( code ) 1.0 Returns the character with the specified ASCII code value (0–255). If the code is outside this range, the result is data source-dependent.
CHAR_LENGTH( string_exp ) 3.0 Returns character length for character data types, or byte length for other types.
CHARACTER_LENGTH( string_exp ) 3.0 Identical to CHAR_LENGTH, returns character or byte length based on the data type.
CONCAT( string_exp1, string_exp2 ) 1.0 Returns a character string formed by concatenating string_exp2 to string_exp1. Behavior with NULL values depends on the DBMS (for example, DB2 returns NULL, while SQL Server returns the non-NULL string).
INSERT( string_exp1, start, length, string_exp2 ) 1.0 Deletes the specified length of characters from string_exp1 and inserts string_exp2 at the start position.
LCASE( string_exp ) 1.0 Converts all uppercase characters in the string to lowercase.
LEFT( string_exp, count ) 1.0 Returns the leftmost count characters of the string.
LENGTH( string_exp ) 1.0 Returns the number of characters in the string (excluding trailing blanks). Implicitly converts input to a string.
LOCATE( string_exp1, string_exp2[, start] ) 1.0 Returns the position of the first occurrence of string_exp1 in string_exp2 starting from position 1 or the optional start value. Returns 0 if string_exp1 is not found.
LTRIM( string_exp ) 1.0 Removes leading blanks from the string.
OCTET_LENGTH(** *string_exp ) 3.0 Returns the length of string_exp in bytes, rounded up to the nearest whole number of bytes (bit count divided by 8). Works for all data types and returns their internal size without implicit conversion to a string.
POSITION( character_exp IN character_exp ) 1.0 Returns the position of the first character expression in the second character expression.
REPEAT( string_exp, count ) 1.0 Returns a character string with string_exp repeated count times.
REPLACE( string_exp1, string_exp2, string_exp3 ) 1.0 Searches string_exp1 for occurrences of string_exp2 and replaces them with string_exp3.
RIGHT( string_exp, count ) 1.0 Returns the rightmost count characters of the string.
RTRIM( string_exp ) 1.0 Removes trailing blanks from the string.
SOUNDEX( string_exp ) 2.0 Returns a character string representing the phonetic sound of string_exp, with format varying by data source (e.g., SQL Server returns a 4-digit code, while Oracle returns a phonetic representation).
SPACE( count ) 2.0 Generates a character string of count spaces.
SUBSTRING( string_exp, start, length ) 1.0 Extracts a substring from string_exp beginning at the start position for the given length.
UCASE( string_exp ) 1.0 Converts all lowercase characters in the string to uppercase.