Home > Archive > MS SQL Server MSEQ > May 2005 > Remove letters in column









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Remove letters in column
DCR

2005-05-18, 8:26 pm

I have a column that have numbers & letters combined in a field. What sql
command would remove the letters only, not the numbers?
I have a table called “customer” and the column in that table is called
“customtext4”. I want to change over 5000 records in this “customtext4” field

Thanks for your help
Dave
Hugo Kornelis

2005-05-19, 8:24 pm

On Wed, 18 May 2005 16:28:01 -0700, DCR wrote:

>I have a column that have numbers & letters combined in a field. What sql
>command would remove the letters only, not the numbers?
>I have a table called customer and the column in that table is called
>customtext4. I want to change over 5000 records in this customtext4 field
>
>Thanks for your help
>Dave


Hi Dave,

String manipulation is a weak spot in SQL Server's command set. This can
be done, but it's clumsy:

UPDATE Customer
SET CustomText4 = REPLACE(
REPLACE(
REPLACE(
....
REPLACE(CustomText, 'A', '')
, 'B', '')
, 'C', '')
.....
, 'Z', '')


Best, Hugo
--

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





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com