String Functions
USE AdventureWorksDW2019MSDS
SELECT
FirstName,
MiddleName,
LastName,
CONCAT(FirstName,MiddleName,LastName) AS SmooshedTogether
FROM dw.DimEmployee
WHERE 1 = 1
AND IsMostRecentRecord = 1
SELECT
EnglishDescription,
LEN(EnglishDescription) AS CountOfCharactersInDescription
FROM dw.DimProduct
WHERE 1 = 1
AND EnglishDescription IS NOT NULL
AND IsMostRecentRecord = 1
SELECT
EnglishDescription,
LEFT(EnglishDescription,20) AS Left20Chars
FROM dw.DimProduct
WHERE 1 = 1
AND EnglishDescription IS NOT NULL
AND IsMostRecentRecord = 1
SELECT
EnglishDescription,
RIGHT(EnglishDescription,20) AS Right20Chars
FROM dw.DimProduct
WHERE 1 = 1
AND EnglishDescription IS NOT NULL
AND IsMostRecentRecord = 1
SELECT
EnglishProductName,
REPLACE(EnglishProductName,'Road', 'Street') AS NameChanged
FROM dw.DimProduct
WHERE 1 = 1
AND ProductSubcategoryCK = 14
AND IsMostRecentRecord = 1
SELECT
EnglishDescription,
SUBSTRING(EnglishDescription, 10, 15) AS RandomSubstringSelection
FROM dw.DimProduct
WHERE 1 = 1
AND EnglishDescription IS NOT NULL
AND IsMostRecentRecord = 1
Last updated