Introduction
SQL Server String functions are scalar functions that perform an operation on a string input values and return a string or numeric value. SQL Server String built-in function. In this section, we cover string function seen in SQL. Different RDBMS may employ different string functions.
List Of String Function
- ASCII
- CHAR
- REVERSE
- UPPER
- LEFT
- LEN
- LOWER
- LTRIM
- NCHAR
- REPLACE
Explanation Of All Above Functions
- ASCII
Return the ASCII code value of the left most character of the current string. ASCII() works for characters with numeric values from 0 to 255. Here’s Figure 1.1.
![ASCII]()
- CHAR
Convert an int ASCII code to character. Null Values are skipped. It is opposite to ASCII() function. Here’s Figure 1.2.
![CHAR]()
- REVERSE
Return the string with the order the characters reversed. See reverse string in Figure 1.3.
![REVERSE]()
- UPPER
Returns a UPPER case string. Here’s Figure 1.4 and you can see lower string value converted to upper case string.
![UPPER]()
- LEFT
Returns the left part of a character string with the specified number of characters. Here’s Figure 1.5 Left() function two arguments:
1. String
2. Length of string
![LEFT]()
- LEN
Returns the number of characters, instead of the number of bytes of the specified string. Length of string in Figure 1.6.
![LEN]()
- LOWER
Returns a character string after converting uppercase string to lower strings. Here’s string is UPPER case string To lower case string.
![LOWER]()
- LTRIM
Remove leading blanks spaces in string.
![LTRIM]()
- NCHAR
Return specified integer code defined by Unicode standard. Same as Char() function. (Figure 1.9).
![NCHAR]()
- REPLACE
Replace one string to second string. Replace() performs a case-sensitive match when searching for form_str.
![REPLACE]()