MySql query help needed asap.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Pics Traffic
    Confirmed User
    • Jun 2004
    • 3055

    #1

    MySql query help needed asap.

    I have a field in db that is 10 char long and its random characters.
    I need to either truncate every one of them to 9 chars or replace last characters with "xx"

    Is there way to do it with query that will update all rows of data?
    My Network Is Waiting For Your Fuckin' Trade!
  • sortie
    Confirmed User
    • Mar 2007
    • 7771

    #2
    MySQHell.

    Comment

    • woj
      <&(©¿©)&>
      • Jul 2002
      • 47880

      #3
      probably just change the field from 10 to 9 characters... but make a backup of the table in case something goes wrong...
      Custom Software Development, email: woj#at#wojfun#.#com to discuss details or skype: wojl2000 or gchat: wojfun or telegram: wojl2000
      Affiliate program tools: Hosted Galleries Manager Banner Manager Video Manager
      Wordpress Affiliate Plugin Pic/Movie of the Day Fansign Generator Zip Manager

      Comment

      • tical
        Confirmed User
        • Feb 2002
        • 6504

        #4
        mysql will prob error if you try to change the field to 9 chrs... back up before trying this, but it should work (and do it to the whole table)


        update table set field = substring(field, 1, 9)
        112.020.756

        Comment

        Working...