Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,
How can i replace many character in 1 query
eg:-

,<html>
All above character should replace wirh space.
Below is my query

C#
select empDesc from emp


empname has the character that should replace with space

Please help

Posted
Comments
Maciej Los 12-Feb-13 5:23am    
Not clear, please, be more specific and provide more details.
Raj tilak Bose 12-Feb-13 5:28am    
select empDesc from emp
when i fetch with above query below data comes
<html>i am % a good #@ boy.
I want my query should return only
i am a good boy

All above <html> % # @ should replace with space. How can i achieve it with a single query



1 solution

You can multiply REPLACE()[^] function.
SQL
DECLARE @aText NVARCHAR(100)

SET @aText = '<html>i am % a good #@ boy.'

SELECT REPLACE(REPLACE(REPLACE(@aText,'#@',''),'%',''),'<html>','')

Result: i am a good boy
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900