The SQL Server provides various String Functions. These string functions allow us to alter the individual characters in a string, compare two, search for a substring, extract substrings, and copy a string. You can also use these SQL String Functions to convert them to lowercase or uppercase.
A string is a group of charters stored in Varchar or Nvarchar data type, which is useful to store names, product descriptions, etc. SQL String functions enable you to manipulate the string data by searching for the given substring and replacing it or adding so on. This article shows you the available list of SQL string functions and their definitions.
SQL String Functions
The following table will show you the list of available SQL String Functions. Use those links to see the practical example for each one of the string functions.
Functions | Description |
---|---|
ASCII | It returns the ASCII code of the leftmost character of a character expression. |
CHAR | Convert the integer value (ASCII code) to a character |
CHARINDEX | It returns the index position of a specified expression |
CONCAT | Combine or concatenate two or more and returns string. |
CONCAT_WS | This function concatenates two or more SQL Server string using a separator. |
DIFFERENCE | Return the difference between the SOUNDEX values of the specified character expressions |
FORMAT | Format the expression with the specified format. |
LEN | To find the length of a specified expression |
LEFT | Returns the leftmost characters from the specified expression |
LTRIM | It removes the empty spaces from Left side of a character expression |
LOWER | It converts the given text or expression to Lowercase. |
NCHAR | Thie SQL String function returns the Unicode character at the specified integer value |
QUOTENAME | It return the Unicode string with the delimiters |
REPLACE | We can use this function to replace the existing string with new value. |
REPLICATE | Repeat the existing sentence for a given number of times. |
REVERSE | Helps to reverse the specified expression |
RIGHT | Return the rightmost characters from a given expression |
RTRIM | It removes empty spaces from the Right-hand side of a given expression. |
PATINDEX | It is used to return the starting index position of the first occurrence of a pattern in an expression. |
SOUNDEX | This SQL String function returns the SOUNDEX code. |
SPACE | Returns the string of repeated spaces. |
STR | It returns the string representation of the numeric expression. |
STRING_ESCAPE | This function escapes the special characters from the text. |
STRING_SPLIT | Split the character expression using the separator. |
SUBSTRING | It returns a specified number of characters from the given expression. |
TRIM | Remove the empty spaces from both the right and left side. |
UNICODE | Return the Unicode (integer) value, as defined in Unicode standards. |
UPPER | This function convert the given text or expression to Uppercase |
Comments are closed.