Using REPLACE in an UPDATE statement
SELECT Replace('SQLTeam.com Rocks!', 'Rocks', 'Rolls')
A powerful combination
JavaScript is the de facto standard for client-side Web development. Combining it with ASP.NET Web forms provides the developer with a powerful set of tools for building robust applications that consider performance a key ingredient.
ID name salary start_date city region
------ ---------- ----------- ----------------------- ---------- ------
1 Jason 40420 1994-02-01 00:00:00.000 New York W
2 Robert 14420 1995-01-02 00:00:00.000 Vancouver N
3 Celia 24020 1996-12-03 00:00:00.000 Toronto W
4 Linda 40620 1997-11-04 00:00:00.000 New York N
5 null 80026 1998-10-05 00:00:00.000 Vancouver W
6 null 70060 1999-09-06 00:00:00.000 Toronto N
7 null 90620 2000-08-07 00:00:00.000 New York W
8 Chris 26020 2001-07-08 00:00:00.000 Vancouver N
9 Mary 60020 2002-06-09 00:00:00.000 Toronto W
ID name salary start_date city region
----------- ---------- ----------- ----------------------- ---------- ------
1 Jason 40420 1994-02-01 00:00:00.000 New York W
2 Robert 14420 1995-01-02 00:00:00.000 Vancouver N
3 Celia 24020 1996-12-03 00:00:00.000 Toronto W
4 Linda 40620 1997-11-04 00:00:00.000 New York N
5 David 80026 1998-10-05 00:00:00.000 Vancouver W
6 James 70060 1999-09-06 00:00:00.000 Toronto N
7 Alison 90620 2000-08-07 00:00:00.000 New York W
8 Chris 26020 2001-07-08 00:00:00.000 Vancouver N
9 Mary 60020 2002-06-09 00:00:00.000 Toronto W
Exp: #2SELECT REPLACE('AsmA Qureshi Software Developer','Software Developer','Project Manager') as AQCOL
S.No AQCOL ------- ----------------------------- 1 AsmA Qureshi Project Manager
------- -----------------------------
Exp: #3
SELECT
REPLACE('Banana', REPLACE('Orange', REPLACE('Banana', Product, 'Fruit'),
'Fruit'), 'Fruit') AS Product
FROM
Table
Product Quantity ------- -------- Apple 2 Orange 3 Banana 1 Vegetable 7 Dairy 6
would becomeProduct Quantity ------- -------- Fruit 2 Fruit 3 Fruit 1 Vegetable 7 Dairy 6 Exp Query
SELECT REPLACE('Banana', REPLACE('Orange', REPLACE('Banana', Product, 'Fruit'), 'Fruit'), 'Fruit') AS Product FROM Table