Solved

Removing special characters from column

Posted on 2011-03-04
4
410 Views
Last Modified: 2012-05-11
How would I remove special charaters (/) from my fname column. the position of these characters are not predictable. I would like to have Space instead of this character in my table.
the records are somthing like this
'X/YZ'
'AB/C'
Please suggest.
0
Comment
Question by:parpaa
  • 2
4 Comments
 
LVL 18

Expert Comment

by:Cluskitt
ID: 35035453
UPDATE table
SET fname=REPLACE(fname,"/","")
WHERE fname LIKE '%/%'
0
 
LVL 18

Accepted Solution

by:
Cluskitt earned 125 total points
ID: 35035461
Or you can even drop the where part. It will simply update all records, regardless of having a / or not. When it doesn't, it updates to the same value, though.
0
 
LVL 22

Expert Comment

by:Thomasian
ID: 35035637
SELECT REPLACE(fname, '/', ' ') FROM tablename

Open in new window


OR to replace the values permanently:

UPDATE tablename SET fname = REPLACE(fname, '/', ' ') WHERE fname LIKE '%/%'

Open in new window

0
 

Author Closing Comment

by:parpaa
ID: 35041720
Thanks very much
It worked perfectly
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

816 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now