- Tags: SQL Server
- Categories: Reference, SQL Reference, SQL Resources
Quick Reference
This is a quick reference list of SQL Server string functions and how they are used to work with databases.
SQL – SQL Server ASCII() Function
The SQL Server ASCII() function returns the ASCII value for the specified character.
SQL – SQL Server CHAR() Function
The SQL Server CHAR() function returns the character based on the ASCII code specified.
SQL – SQL Server CHARINDEX() Function
The SQL Server CHARINDEX() function searches for a substring in a string, and returns the position. If the substring is not found, this function returns 0.
SQL – SQL Server CONCAT() Function
The SQL Server CONCAT() function adds two or more strings together.
SQL – SQL Server Concat With +
The SQL Server + operator allows you to add two or more strings together.
SQL – SQL Server CONCAT_WS() Function
The SQL Server CONCAT_WS() function adds two or more strings together with a separator.
SQL – SQL Server DATALENGTH() Function
The SQL Server DATALENGTH() function returns the number of bytes used to represent an expression.
SQL – SQL Server DIFFERENCE() Function
The SQL Server DIFFERENCE() function compares two SOUNDEX values, and returns an integer.
SQL – SQL Server FORMAT() Function
The SQL Server FORMAT() function formats a value with the specified format (and an optional culture in SQL Server 2017).
SQL – SQL Server LEFT() Function
The SQL Server LEFT() function extracts a number of characters (starting from left) from a string.
SQL – SQL Server LEN() Function
The SQL Server LEN() function returns the length of a string. Trailing spaces (after) are not included, but leading spaces (before) are included.
SQL – SQL Server LOWER() Function
The SQL Server LOWER() function converts a string to lower-case.
SQL – SQL Server LTRIM() Function
The SQL Server LTRIM() function removes leading spaces from a string. Leading spaces are spaces before (left of) the string.
SQL – SQL Server NCHAR() Function
The SQL Server NCHAR() function returns the Unicode character based on the number code provided.
SQL – SQL Server PATINDEX() Function
The SQL Server PATINDEX() function returns the position of a pattern in a string. If the pattern is not found, this function returns 0.
SQL – SQL Server QUOTENAME() Function
The SQL Server QUOTENAME() function returns a Unicode string with delimiters added to make the string a valid SQL Server delimited identifier.
SQL – SQL Server REPLACE() Function
The SQL Server REPLACE() function replaces all occurrences of a substring (case-insensitive) within a string, with a new substring.
SQL – SQL Server REPLICATE() Function
The SQL Server REPLICATE() function repeats a specified string a specified number of times.
SQL – SQL Server REVERSE() Function
The SQL Server REVERSE() function reverses a specified string and returns the result.
SQL – SQL Server RIGHT() Function
The SQL Server RIGHT() function extracts a number of characters (starting from right) from a string.
SQL – SQL Server RTRIM() Function
The SQL Server RTRIM() function removes trailing spaces from a string. Trailing spaces are spaces after (right of) the string.
SQL – SQL Server SOUNDEX() Function
The SQL Server SOUNDEX() function returns a four-character code to evaluate the similarity of two expressions.
SQL – SQL Server SPACE() Function
The SQL Server SPACE() function returns a string of the specified number of space characters.
SQL – SQL Server STR() Function
The SQL Server STR() function returns a number as a string.
SQL – SQL Server STUFF() Function
The SQL Server STUFF() function deletes a part of a string, starting at a specified position, and then inserts a new part into the string at that position.
SQL – SQL Server SUBSTRING() Function
The SQL Server SUBSTRING() function extracts a specified number of characters from a specified position in a string.
SQL – SQL Server TRANSLATE() Function
The SQL Server TRANSLATE() function returns the string from the first argument after the characters in the second argument are translated into it.
SQL – SQL Server TRIM() Function
The SQL Server TRIM() function removes leading and trailing spaces (default) OR other specified characters from the start or end of a string.
SQL – SQL Server UNICODE() Function
The SQL Server UNICODE() function returns an integer value (the Unicode value) for the first character of the input expression.
SQL – SQL Server UPPER() Function
The SQL Server UPPER() function converts a string to upper-case.
We’d like to acknowledge that we learned a great deal of our coding from W3Schools and TutorialsPoint, borrowing heavily from their teaching process and excellent code examples. We highly recommend both sites to deepen your experience, and further your coding journey. We’re just hitting the basics here at 1SMARTchicken.
Why 1SMARTchicken?
See More →
Thanks for your support!
SQL Books
All are affiliate links. Thank you for your support!
SQL NOTES:
- Any work being done to modify the structure of a database or delete tables or the the database itself should only be done after making a recent backup
Feedback
If you see an error on the page or the code itself is incorrect or incomplete, or just plain wrong, please let us know. We’re always learning. NOTE: we do not sell your information and will not send you spam emails.