I have a string column (Col1) in table (Tab1). I want to write a script that removes '%'
or '&' characters from the string values.
The select for this is the following:
SELECT REPLACE( Tab1.Col1, '&', ''),
REPLACE(Tab1.Col1, '%', '')
FROM Table1 Tab1
WHERE Tab1.Col1 like '%[&]%'
OR Tab1.Col1 like '%[%]%'
Does this seem correct? If it is how would I convert this to any update statement? I tried the following:
UPDATE Tab1
SET Tab1.Col1 = REPLACE( Tab1.Col1, '&', ''),
Tab1.Col1 = REPLACE (Tab1.Col1, '%', '')
FROM Table1 Tab1
WHERE Tab1.Col1 like '%[&]%'
OR Tab1.Col1 like '%[%]%'
This doesn't work as you cant update column twice in SET
.
Is there any other way I can do this? I know I'm probably doing something silly here so apologies for my ignorance.
Thanks in advance.