Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2004
    Posts
    5

    Unanswered: How to some text withing a field

    Are there any examples of an update query that can search a field for a set of characters and replace only those characters? EG "ABC1234" change all BC to DE.

  2. #2
    Join Date
    Aug 2004
    Posts
    330
    Depending upon your dbms, try looking for a REPLACE() function.

    It might look something like this:

    UPDATE TABLE1
    SET COL1 = REPLACE(COL1,'BC','DE')
    WHERE ...

    You will have to read your manuals to find the exact syntax for the function.(If it exitsts.)

  3. #3
    Join Date
    Sep 2003
    Location
    UK
    Posts
    122
    You might find it faster to return the record set "...where [field] like * &[search term] & *" and then itterate thru' the recordset doing an update little by little (unless the fields are more or less the same.

    It will be slowish to VERY VERY slow to do it that way (depends on a bunch of stuff) so if Replace() works with your SQL version go for it. Otherwise welcome to slow-ville.
    Matt the Hat says: "what!?"
    A child of five could understand this! Fetch me a child of five!
    SCARY HARD CHALLENGE: http://www.dbforums.com/showthread.php?threadid=988682

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •