Lesson 9. String Functions
If you work in analytics, you are going to be spending a lot of time manipulating strings. You are pretty much going to use ALL the string functions at some point.
This is an opinionated list of frequently used string functions.
CONCAT
Lets you combine string values.
LEN
Lets you count the number of characters a string has. Does not count trailing spaces.
LEFT
Lets you select a specified number of characters from the left.
RIGHT
Lets you select a specified number of characters from the right.
LTRIM
Lets you remove spaces from the start of a string.
RTRIM
Lets you remove spaces from the end of a string.
REPLACE
Lets you replace a string in a string with another string.
SUBSTRING
Lets you select a specified number of characters from any starting point in a string.
Examples
Example Of String Function Usage
Here is example usage of the functions above. Some functions like RTRIM are hard to determine if anything is happening because the data in AdventureWorks is very clean.
Parameter values are 1 based meaning that the index starts at 1.
Last updated