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() FunctionThe SQL Server ASCII() function returns the ASCII value for the specified character.
- SQL – SQL Server CHAR() FunctionThe SQL Server CHAR() function returns the character based on the ASCII code specified.
- SQL – SQL Server CHARINDEX() FunctionThe 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() FunctionThe 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() FunctionThe SQL Server CONCAT_WS() function adds two or more strings together with a separator.
- SQL – SQL Server DATALENGTH() FunctionThe SQL Server DATALENGTH() function returns the number of bytes used to represent an expression.
- SQL – SQL Server DIFFERENCE() FunctionThe SQL Server DIFFERENCE() function compares two SOUNDEX values, and returns an integer.
- SQL – SQL Server FORMAT() FunctionThe SQL Server FORMAT() function formats a value with the specified format (and an optional culture in SQL Server 2017).
- SQL – SQL Server LEFT() FunctionThe SQL Server LEFT() function extracts a number of characters (starting from left) from a string.
- SQL – SQL Server LEN() FunctionThe 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() FunctionThe SQL Server LOWER() function converts a string to lower-case.
- SQL – SQL Server LTRIM() FunctionThe SQL Server LTRIM() function removes leading spaces from a string. Leading spaces are spaces before (left of) the string.
- SQL – SQL Server NCHAR() FunctionThe SQL Server NCHAR() function returns the Unicode character based on the number code provided.
- SQL – SQL Server PATINDEX() FunctionThe 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() FunctionThe 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() FunctionThe SQL Server REPLACE() function replaces all occurrences of a substring (case-insensitive) within a string, with a new substring.
- SQL – SQL Server REPLICATE() FunctionThe SQL Server REPLICATE() function repeats a specified string a specified number of times.
- SQL – SQL Server REVERSE() FunctionThe SQL Server REVERSE() function reverses a specified string and returns the result.
- SQL – SQL Server RIGHT() FunctionThe SQL Server RIGHT() function extracts a number of characters (starting from right) from a string.
- SQL – SQL Server RTRIM() FunctionThe SQL Server RTRIM() function removes trailing spaces from a string. Trailing spaces are spaces after (right of) the string.
- SQL – SQL Server SOUNDEX() FunctionThe SQL Server SOUNDEX() function returns a four-character code to evaluate the similarity of two expressions.
- SQL – SQL Server SPACE() FunctionThe SQL Server SPACE() function returns a string of the specified number of space characters.
- SQL – SQL Server STR() FunctionThe SQL Server STR() function returns a number as a string.
- SQL – SQL Server STUFF() FunctionThe 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() FunctionThe SQL Server SUBSTRING() function extracts a specified number of characters from a specified position in a string.
- SQL – SQL Server TRANSLATE() FunctionThe 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() FunctionThe 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() FunctionThe SQL Server UNICODE() function returns an integer value (the Unicode value) for the first character of the input expression.
- SQL – SQL Server UPPER() FunctionThe SQL Server UPPER() function converts a string to upper-case.
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
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.