Whats the error you are getting returned?
And can you post the SQL code you are executing?

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Adam
Chapman
Sent: Tuesday, 8 July 2003 9:08 AM
To: CFAussie Mailing List
Subject: [cfaussie] Re: Replace in SQL rather that CF


Hey Steve,

> so you want to do an update on the table

No.. I just want to select records where the
Length of the mobile number is 10 (without spaces).
I tried running the code I had but returned a syntax
Error.

Cheers,
Adam

-----Original Message-----
From: Steve Onnis [mailto:[EMAIL PROTECTED] 
Sent: Monday, July 07, 2003 6:12 PM
To: CFAussie Mailing List
Subject: [cfaussie] Re: Replace in SQL rather that CF


ok

so you want to do an update on the table

try this first

SELECT name,
         address,
         Replace(mobileNumber,' ','') AS Mobile,
         Len(Replace(mobileNumber,' ','')) AS MobileLen
FROM     thisTable
WHERE  mobileNumber LIKE '% %'

That will give you all the records that have spaces, the number with
spaces removed and also the length

If the result is to your liking, then use that to do your update

UDATE thisTable
SET     MobileNumber = Replace(mobileNumber,' ','')
WHERE mobileNumber LIKE '% %'

Now just to mention other databases.  If there is one thing I loved with
mySQL is that you can use regular expressions, so you can do this

UDATE thisTable
SET     MobileNumber = REPLACE(MobileNumber,'REGEXP "[^[:digit:]]"','')
WHERE mobileNumber LIKE '% %'


I like that

Steve



---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED] To
unsubscribe send a blank email to
[EMAIL PROTECTED]

MX Downunder AsiaPac DevCon - http://mxdu.com/



---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]

MX Downunder AsiaPac DevCon - http://mxdu.com/

Reply via email to