• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 604
  • Last Modified:

SQL statement to find and replace character in field...

Can someone tell me the correct statement to use in order to find and replace specific characters in a field....for example

Find all the "/" in all records of the telephone number field
and replace it with "-"

I am sure this is very straight forward, but I am a dummy with SQL.
0
IO_Dork
Asked:
IO_Dork
  • 2
  • 2
1 Solution
 
tusharkanvindeCommented:
update YourTable set YourField with CHRTRAN(YourField,'/','-')
0
 
IO_DorkAuthor Commented:
Fantastic!  Direct and to the point!
0
 
pcelbaCommented:
This command will raise syntax error

You have two options:
update YourTable set YourField = CHRTRAN(YourField,'/','-')

SELECT YourTable
REPLACE ALL YourField with CHRTRAN(YourField,'/','-')
0
 
tusharkanvindeCommented:
oops

0
 
IO_DorkAuthor Commented:
Thanks pcelba!!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now