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
- Aggregate Functions in SQL Server
- Retrieve Unsaved SQL Query Scripts
- Select Statement Execution Order In SQL Server
- System Databases in SQL Server
- MS SQL Server – Zero to Hero Query Master – Part 4
- Schema Comparisons using Visual Studio SQL Data Tools
- Link a SQL Server Database Project to a Git Repository
- Create and Publish SQL Server Database Project With Visual Studio
- Customize Azure Data Studio with Dashboard Widgets
- Cycle Clipboard Ring In SSMS – Reuse Copied Items
- Set custom colors to differentiate between environments in SSMS
- Recover unsaved SQL queries in SSMS
- Multiple Backup Files of the SQL Server database with SSMS and T-SQL
- Difference between CURRENT_TIMESTAMP vs GETDATE() vs SYSDATETIME() vs GETUTCDATE() in SQL Server