String Functions
Function |
ASCII |
Description |
Returns the ASCII code value of the leftmost character of a character expression. |
Example |
SELECT ASCII('A') |
Result |
65 |
* * * * *
Function |
CHAR |
Description |
A string function that converts an int ASCII code to a character. |
Example |
SELECT CHAR(97) |
Result |
a |
* * * * *
Function |
LEFT |
Description |
Returns the part of a character string at a specified number of characters from the left. |
Example |
SELECT LEFT('PREM NATH R.K',4) |
Result |
PREM |
* * * * *
Function |
RIGHT |
Description |
Returns the part of a character string starting a specified number of interger expression characters from the right. |
Example |
SELECT RIGHT('PREM NATH R.K',3) |
Result |
R.K |
* * * * *
Function |
LTRIM |
Description |
Returns a character expression after deleting leading blanks. |
Example |
SELECT 'PREM ' + LTRIM(' NATH R.K') |
Result |
PREM NATH R.K |
* * * * *
Function |
RTRIM |
Description |
Returns a character string after truncating all blanks. |
Example |
SELECT 'PREM ' + RTRIM('NATH R.K ') |
Result |
PREM NATH R.K |
* * * * *
Function |
SUBSTRING |
Description |
Returns part of a character, binary, text, or image expression. |
Example |
SELECT SUBSTRING('PREM NATH R.K',1,4) |
Result |
PREM |
* * * * *
Function |
LOWER |
Description |
Returns a character expression after converting uppercase character data to lowercase data. |
Example |
SELECT LOWER('PREM') |
Result |
prem |
* * * * *
Function |
UPPER |
Description |
Returns a character expression with lowercase character data converted to uppercase data. |
Example |
SELECT UPPER('prem') |
Result |
PREM |
* * * * *
Function |
LEN |
Description |
Returns the number of characters, rather than the number of bytes, of the given string expression, excluding trailing blanks. |
Example |
SELECT LEN('PREM') |
Result |
4 |
* * * * *
Function |
REVERSE |
Description |
Returns the reverse of a character data expression. |
Example |
SELECT REVERSE('PREM') |
Result |
MERP |
* * * * *
Function |
REPLACE |
Description |
Replaces all occurrences of the second given string expression in the first string expression with a third expression. |
Example |
SELECT REPLACE('PREM','M','N') |
Result |
PREN |
* * * * *
Function |
SPACE |
Description |
Returns a string of repeated spaces. |
Example |
SELECT 'PREM' + SPACE(1) + 'NATH R.K' |
Result |
PREM NATH R.K |
* * * * *
Function |
STR |
Description |
Returns character data converted from numeric data. |
Example |
SELECT STR(123.45) |
Result |
123 |
|