String

String#

String functions operate on character input and return a character or numeric result — searching, trimming, replacing, formatting and measuring text.

Function

Description

ASCII

Returns the ASCII code value of the leftmost character of a character expression.

CHAR

Converts an int ASCII code to a character.

CHARINDEX

Searches an expression for another expression and returns its starting position if found.

CONCAT

Returns a string that is the result of concatenating two or more string values.

FORMAT

Returns a value formatted with the specified format and optional culture. Use the FORMAT function for locale-aware formatting of date/time and number values as strings.

LEFT

Returns the left part of a character string with the specified number of characters.

LEN

Returns the number of characters of the specified string expression, excluding trailing blanks.

LEVENSHTEIN

Returns the Levenshtein distance between the two given strings.

LOWER

Returns a character expression after converting uppercase character data to lowercase.

LTRIM

Returns a character expression after it removes leading blanks.

NCHAR

Returns the Unicode character with the specified integer code, as defined by the Unicode standard.

PATINDEX

Returns the starting position of the first occurrence of a pattern in a specified expression, or zeros if the pattern is not found, on all valid text and character data types.

QUOTENAME

Returns a Unicode string with the delimiters added to make the input string a valid SQL Server delimited identifier.

REGEX_EXTRACT

Extracts a given group that matches the java-style regular expression.

REGEX_REPLACE

Replaces all occurrences of a specified string value that match a java-style regular expression with the replacement string.

REGEX_SPLIT

Extracts a group that matches the POSIX-style regular expression.

REPLACE

Replaces all occurrences of a specified string value with another string value.

REPLICATE

Repeats a string value a specified number of times.

REVERSE

Returns the reverse order of a string value.

RIGHT

Returns the right part of a character string with the specified number of characters.

RTRIM

Returns a character string after truncating all trailing spaces.

SPACE

Returns a string of repeated spaces.

SPLIT

Splits a string around a java-style regular expression.

STR

Returns character data converted from numeric data.

STUFF

The STUFF function inserts a string into another string. It deletes a specified length of characters in the first string at the start position and then inserts the second string into the first string at the start position.

SUBSTRING

Returns part of a character, binary, text, or image expression.

UNICODE

Returns the integer value, as defined by the Unicode standard, for the first character of the input expression.

UPPER

Returns a character expression with lowercase character data converted to uppercase.