?
Solved

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

Posted on 2009-12-20
5
Medium Priority
?
585 Views
Last Modified: 2012-05-08
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
Comment
Question by:IO_Dork
  • 2
  • 2
5 Comments
 
LVL 14

Accepted Solution

by:
tusharkanvinde earned 2000 total points
ID: 26093761
update YourTable set YourField with CHRTRAN(YourField,'/','-')
0
 

Author Closing Comment

by:IO_Dork
ID: 31668398
Fantastic!  Direct and to the point!
0
 
LVL 43

Expert Comment

by:pcelba
ID: 26094563
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
 
LVL 14

Expert Comment

by:tusharkanvinde
ID: 26095231
oops

0
 

Author Comment

by:IO_Dork
ID: 26097617
Thanks pcelba!!
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Microsoft Visual FoxPro (short VFP) is a programming language with it’s own IDE and database, ranking somewhat between Access and VB.NET + SQL Server (Express). Product Description: http://msdn.microsoft.com/en-us/vfoxpro/default.aspx (http://msd…
Sometimes MS breaks things just for fun... In Access 2003, only the maximum allowable SQL string length could cause problems as you built a recordset. Now, when using string data in a WHERE clause, the 'identifier' maximum is 128 characters. So, …
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses

809 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