Skip to main content
February 10, 2008
Question

Manipulating Data Fields

  • February 10, 2008
  • 1 reply
  • 395 views
Hi,

I have a field in a database called UPC. When I upload data into an Access database, it comes over in the following format: 00-12345-77777 or 07-12345-77777. I need to remove the "hyphens - " and any leading zeros in front of the number, e.g. I'm trying to get to 1234577777 or 71234577777. I can do this quite easily with coldfusion (replace, left, right, etc).

I have limited knowledge of how to do this right in the database. I'm sure the database is capable of doing this, and is probably much faster at it than writing a query to pull it, process it, then send it back to the database.

Any thoughts on the sql to make something like this happen would be greatly appreciated!

Thanks!

cfwild
This topic has been closed for replies.

1 reply

Inspiring
February 10, 2008
If the hyphens and leading zeros are always in the same place, and your db has string functions, That would be the approach to take. Google "ms access string functions" and see if anything promising comes up.

Or, open ms access and press F1 to see what the Help file has to offer.
Participating Frequently
February 11, 2008
Access has Trim() and Replace() functions available, as well as Rtrim() and Ltrim().

SELECT Trim(Replace(UPC, '-', '')) AS new_upc
FROM whatever

Phil