SQL Server String Functions

Introduction

In this article, we will discuss about the SQL Server String Functions (built in functions) in SQL Server.

String Functions in SQL Server

ASCII()

Return the ASCII code value of a character

CHAR()

Convert an ASCII value to a character

CHARINDEX()

Search for a substring inside a string starting from a specified location and return the position of the substring

CONCAT()

Join two or more strings into one string

CONCAT_WS()

Concatenate multiple strings with a separator into a single string

DIFFERENCE()

Compare the SOUNDEX() values of two strings

FORMAT()

Return a value formatted with the specified format and optional culture

LEFT()

Extract a given a number of characters from a character string starting from the left

LEN()

Return a number of characters of a character string

LOWER()

Convert a string to lowercase

LTRIM()

Return a new string from a specified string after removing all leading blanks

NCHAR()

Return 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 string

QUOTENAME()

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

REPLACE()

Replace all occurrences of a substring, within a string, with another substring

REPLICATE()

Return a string repeated a specified number of times

REVERSE()

Return the reverse order of a character string

RIGHT()

Extract a given a number of characters from a character string starting from the right

RTRIM()

Return a new string from a specified string after removing all trailing blanks

SOUNDEX()

Return a four-character (SOUNDEX) code of a string based on how it is spoken

SPACE()

Returns a string of repeated spaces

STR()

Returns character data converted from numeric data

STRING_AGG()

Concatenate rows of strings with a specified separator into a new string

STRING_ESCAPE()

Escapes special characters in a string and returns a new string with escaped characters

STRING_SPLIT()

A table-valued function that splits a string into rows of substrings based on a specified separator

STUFF()

Delete a part of a string and then insert another substring into the string starting at a specified position

SUBSTRING()

Extract a substring within a string starting from a specified location with a specified length

TRANSLATE()

Replace several single-characters, one-to-one translation in one operation

TRIM()

Return a new string from a specified string after removing all leading and trailing blanks

UNICODE()

Returns the integer value, as defined by the Unicode standard, of a character

UPPER()

Convert a string to uppercase

Conclusion

In this article we have discussed about the SQL Server String Functions. I hope you all found this article pretty useful. Please share your feedback in the comment section

Consider reading other SQL articles of Mine

One thought on “SQL Server String Functions

Add yours

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Website Built with WordPress.com.

Up ↑

%d bloggers like this: