TurboSQL Guide

String Operators and Functions

Previous  Top  Next


This is a list of string operators and functions that can be used in TurboSQL.

||

Syntax

string1 || string2

Description

Concatenates the two strings.

ASCII

Syntax

ASCII(string)

Description

Calculates the code point of the first character in the string. Returns NULL if the string is NULL or empty.

CHAR_LENGTH

Syntax

CHAR_LENGTH(string)

Description

Calculates the number of characters in the string.

HEXSTR

Syntax

HEXSTR(number, width)

Description

Calculates an hexadecimal representation of number with at least width characters.

Example

HEXSTR(15, 3) --returns '00F'

LEFTSTR

Syntax

LEFTSTR(string, count)

Description

Calculates the count left characters of string.

LEN

Syntax

LEN(string)

Description

Same as CHAR_LENGTH. Prefer CHAR_LENGTH as it is standard SQL.

LIKE

Syntax

string1 [NOT] LIKE string2

Description

Compares the two strings as defined in standard SQL using the two joker characters % and _.

Examples

'Woolfe' LIKE 'Woo%'
Name LIKE '_oolfe'

LOWER

Syntax

LOWER(string)

Description

Returns the string in lower case.

RIGHTSTR

Syntax

RIGHTSTR(string, count)

Description

Calculates the count right characters of string.

STR

Syntax

STR(number, width, scale, thousand_separator, fill_character, decimal_separator)
STR(enumeration_column_reference)

Description

The first variant calculates a string representation of the number with the given formatting.

The second variant calculates the string representation of the enumeration value.

Example

STR(3.14159, 10, 4, ',', '*', '.') --returns ****3.1416

SUBSTRING

Syntax

SUBSTRING(string FROM start [FOR length])

Returns a partial string of length length from string starting at start.

TRIM

Syntax

TRIM([kind [char] FROM] string)

Description

Returns a string without leading or trailing characters.
Kind is one of LEADING, TRAILING, BOTH. The default for kind is BOTH.
Char is the character that is trimmed away. The default for char is the space.

Examples

All these expressions return 'Carl':

TRIM('  Carl      ')
TRIM(LEADING FROM '   Carl')
TRIM(TRAILING FROM 'Carl    ')
TRIM(BOTH 'x' FROM 'xxCarlxx')

UPPER

Syntax

UPPER(string)

Description

Returns the string in upper case.

See also

General Functions and Operators
Arithmetic Functions and Operators
String Functions and Operators
Date and Time Functions and Operators
Aggregation Functions
Miscellaneous Functions and Operators