Useful functions which will allow to modify the strings within SQL query.

Replace

SELECT REPLACE(Original String,'String to be replaced within Original String','New String') AS [SomeColumn]
FROM [SomeTable]

Works with SQL Server 2008 and newer

Find String within String

This is similar to InStr function in VBA

SELECT CHARINDEX('t', 'Customer') AS FindString

Categorized in:

SQL,

Last Update: May 13, 2024