Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 

Multiple Replace

By Ryan Randall, 2013/05/25

Like the replace function, but can replace more than 1
value at a time.

e.g. select dbo.multiple_replace('hello', 'e', '1', default) gives 'h1llo'.  Equivalent to: select replace('hello', 'e', '1')

e.g. select dbo.multiple_replace('hello world', 'e;w;ld', '1;2;END', default) gives 'h1llo 2orEND'

e.g. select dbo.multiple_replace('hello world', 'e$w$ld', '1$2$END', '$') gives 'h1llo 2orEND'

Total article views: 330 | Views in the last 30 days: 3
 
Related Articles
FORUM

Replace

How to replace a value

FORUM

Multiple replace on 1 column in select statement.

replace(column, stringtoreplace, newstring) for multiple items

FORUM

Replacing strings

Replacing data

FORUM

WILD REPLACE ?

function that will replace text supporting wildcards

FORUM

select query modification

how to replace only null values with strings in select statement

Tags
t-sql    
 
Contribute

Join the most active online SQL Server Community

SQL knowledge, delivered daily, free:

Email address:  

You make SSC a better place

As a member of SQLServerCentral, you get free access to loads of fresh content: thousands of articles and SQL scripts, a library of free eBooks, a weekly database news roundup, a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals that makes it such a success.

Join us!

Steve Jones
Editor, SQLServerCentral.com

Already a member? Jump in:

Email address:   Password:   Remember me: Forgotten your password?
Steve Jones