473,466 Members | 1,301 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Stripping Punctuation

Has anyone had to deal with removing punctuation (commas, apostrophes,
etc.) from a column? What is the most efficient way to have these
characters automatically removed from the column?

Oct 24 '05 #1
3 7323
SQL
use replace
update table set field = replace(field,',','') --commas
update table set field = replace(field,'.','') -- dots
update table set field = replace(field,'''','') --apostrophes
you can put this in a trigger if you want to do this automatically

------------------------------------------------------------------------------------------
"I sense many useless updates in you... Useless updates lead to
defragmentation... Defragmentation leads to downtime...Downtime leads
to suffering..Defragmentation is the path to the darkside.. DBCC
INDEXDEFRAG and DBCC DBREINDEX are the force...May the force be with
you" --
http://sqlservercode.blogspot.com/

Oct 24 '05 #2
On 24 Oct 2005 11:43:32 -0700, SQL wrote:
use replace
update table set field = replace(field,',','') --commas
update table set field = replace(field,'.','') -- dots
update table set field = replace(field,'''','') --apostrophes


Hi SQL,

More efficient to do it all in one pass:

UPDATE table
SET field = REPLACE(REPLACE(REPLACE(field,',',''),'.',''),'''' ,'')

Best, Hugo
--

(Remove _NO_ and _SPAM_ to get my e-mail address)
Oct 24 '05 #3
Thanks!

Hugo Kornelis wrote:
On 24 Oct 2005 11:43:32 -0700, SQL wrote:
use replace
update table set field = replace(field,',','') --commas
update table set field = replace(field,'.','') -- dots
update table set field = replace(field,'''','') --apostrophes


Hi SQL,

More efficient to do it all in one pass:

UPDATE table
SET field = REPLACE(REPLACE(REPLACE(field,',',''),'.',''),'''' ,'')

Best, Hugo
--

(Remove _NO_ and _SPAM_ to get my e-mail address)


Oct 24 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Ralph Freshour | last post by:
I'm taking text from a textarea object and want to strip out characters other than A-Za-z0-9 before I send the data to MySQL table - is there a function I can use to do this in PHP? Thanks...
1
by: Andy Jefferies | last post by:
I'm having problems stripping out the whitespace at the beginning of a particular element. In the XML snippet I've highlighted tabs and returns as ^I and ^M respectively: <para> ^I ^I ...
15
by: Jeff North | last post by:
Hi, I'm using a control called HTMLArea which allows a person to enter text and converts the format instructions to html tags. Most of my users know nothing about html so this is perfect for my...
7
by: Lachlan Hunt | last post by:
Hi, I have recently downloaded and experemented with IBM HPR 3.0, and Opera 8 with text-to-speech, and have come to realise some fairly annoying issues regarding punctuation marks. I've found,...
1
by: dew | last post by:
Is there an easy way to edit a string so that only alphabetical characters and numbers are allowed? Thanks for your help.
3
by: et | last post by:
How can I strip out unwanted characters in a string before updating the database? For instance, in names & addresses in our client table, we want only letters and numbers, no punctuation. Is...
2
by: Anat | last post by:
Hi, I need a little help on performing string manipulation: I want to take a given string, and make certain words hyperlinks. For example: "Hello world, this is a wonderful day!" I'd like the...
6
by: watcher00 | last post by:
Hi I'm a complete newbie at Perl and i was wondering if i can get some help completing an exercise i've come across. I need to count the punctuation marks from a text file and then output a...
1
by: shabda raaj | last post by:
I want to strip punctuation from text. So I am trying, ' !! ! ... ?' Which gave me all the chars which I want to replace. So Next I tried by negating the regex,
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.