SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Addict
    Join Date
    May 2003
    Location
    nyc
    Posts
    363
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    updating all rows in a table (replacing "??" with empty string)

    hello all,

    i have a table whose data has a lot of "????" (since the data was inserted before i made the db inserts utf-8-compliant). i'd like to run a query that uses built in mysql function(s) to replace '??' with '' for a particular column in all table rows.

    any suggestions?

    thanks
    james

  2. #2
    SitePoint Wizard Lats's Avatar
    Join Date
    Jun 2003
    Location
    Melbourne, AU
    Posts
    1,142
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Something like this...
    Code:
    UPDATE TableName SET field =  REPLACE ( field, '??', '' )
    WHERE field LIKE  '%??%'
    Lats...

  3. #3
    SitePoint Addict
    Join Date
    May 2003
    Location
    nyc
    Posts
    363
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Lats,

    Perfect--thanks a lot for that. i just realized however that the '??' is what it looks like when rendered in html. when i query for the field values directly using command prompt, the characters in question show up as '���������'

    what would the where clause look like? :-)

    james

  4. #4
    SitePoint Wizard Lats's Avatar
    Join Date
    Jun 2003
    Location
    Melbourne, AU
    Posts
    1,142
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That's weird, mysql doesn't like interacting with those characters.

    Does the field containing those characters have anything else in it?
    Lats...


Bookmarks

Posting Permissions

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