SQL Server has many built-in functions.
This reference contains string, numeric, date, conversion, and some advanced functions in SQL Server.
SQL Server String Functions
Function |
Description |
ASCII |
Returns the ASCII value for the specific character |
CHAR |
Returns the character based on the ASCII code |
CHARINDEX |
Returns the position of a substring in a string |
CONCAT |
Adds two or more strings together |
Concat with + |
Adds two or more strings together |
CONCAT_WS |
Adds two or more strings together with a separator |
DATALENGTH |
Returns the number of bytes used to represent an expression |
DIFFERENCE |
Compares two SOUNDEX values, and returns an integer value |
FORMAT |
Formats a value with the specified format |
LEFT |
Extracts a number of characters from a string (starting from left) |
LEN |
Returns the length of a string |
LOWER |
Converts a string to lower-case |
LTRIM |
Removes leading spaces from a string |
NCHAR |
Returns the Unicode character based on the number code |
PATINDEX |
Returns the position of a pattern in a string |
QUOTENAME |
Returns a Unicode string with delimiters added to make the string a valid SQL Server delimited identifier |
REPLACE |
Replaces all occurrences of a substring within a string, with a new substring |
REPLICATE |
Repeats a string a specified number of times |
REVERSE |
Reverses a string and returns the result |
RIGHT |
Extracts a number of characters from a string (starting from right) |
RTRIM |
Removes trailing spaces from a string |
SOUNDEX |
Returns a four-character code to evaluate the similarity of two strings |
SPACE |
Returns a string of the specified number of space characters |
STR |
Returns a number as string |
STUFF |
Deletes a part of a string and then inserts another part into the string, starting at a specified position |
SUBSTRING |
Extracts some characters from a string |
TRANSLATE |
Returns the string from the first argument after the characters specified in the second argument are translated into the characters specified in the third argument. |
TRIM |
Removes leading and trailing spaces (or other specified characters) from a string |
UNICODE |
Returns the Unicode value for the first character of the input expression |
UPPER |
Converts a string to upper-case |
Continue reading SQL Server Functions