Search
Hall of Fame
About Us
All Questions
New Question
Login
SQL Server - Remove the % character from the string
Asked By
Anandh Ramanujam
on 25-Jan-11 11:04 AM
Hi,
I want to remove the % character from the string.. how can we do that in sql..
thanks.
anil soni
replied to
Anandh Ramanujam
on 25-Jan-11 11:09 AM
Use the replace function and replace % to a blank string. E.g.
set @str = replace(@str,'%','')
Sundarasegaram Veerakuddy
replied to
Anandh Ramanujam
on 25-Jan-11 11:10 AM
Hi,
Use REPLACE function as,
UPDATE <table> SET <column> = REPLACE(<column>,'%','') WHERE <condition>
Hope this assists.
Daivagna Nanavati
replied to
Anandh Ramanujam
on 26-Jan-11 02:18 AM
Hi Anandh
Here is the query and example i have created
DECLARE
@str
AS
VARCHAR
(50)
SET
@str=
'%daivagna%'
print @str
set
@str =
replace
(@str,
'%'
,
''
)
print @str
you can see the below image
you can see the '%' is replaced
let me know
Thanks
INSTANTLY dtSearch TERABYTES OF POPULAR DATA TYPES; hundreds of reviews, etc.!