MySQL Database replacement

Source: Internet
Author: User

Tag:os   ar   for   sp    Data    on     code    ad   bs   

Replace the welcom to in the Cdb_pms table Subject field with the   welcome   copy Code   code as follows:update  ' Cdb_pms '  SET  ' Subject '  = replace (' subject ',  ' welcome to ',  ' welcome ')  where instr (' Subject ', ' Welcome to ')  > 0  replace the message field of the Cdb_posts table with "viewthread.php?tid=3989" to "viewthread.php?" tid=16546 "  Copy code   code as follows:update  ' cdb_posts '  SET  ' message ' = replace (' message ',  ') viewthread.php?tid=3989 ',  ' viewthread.php?tid=16546 ')  where instr (' message ', ' Viewthread.php?tid =3989 ')  > 0 ;  remove all spaces   Copy code   code as follows:update  ' es_product '  SET  ' Pro_ Pub_time '  = trim (' pro_pub_time ')   Remove all ' [' or '] ' or '. ' The character   copy code   code below:update  ' es_product '  SET  ' pro_pub_time '  = replace (' pro_pub_ Time ',  ' [', ' ')  where instr (' Pro_pub_time ', ' [')  > 0 UPDATE  ' es_product '  SET  ' Pro_pub_time '  = replace (' Pro_pub_time ', &nbsp, '] ', ')  where instr (' Pro_pub_time ', '] ')  > 0 UPDATE  ' es_product '  set   ' Pro_pub_time '  = replace (' pro_pub_time ',  '. ', '-')  where instr (' Pro_pub_time ', '. ')  > 0  Replace all English '-'-'   copy code   code as follows:update  ' es_product '  SET  ' pro_pub_ Time '  = replace (' pro_pub_time ',  '-', '-')  where instr (' Pro_pub_time ', '-')  >  0  Replace all years with '-'   copy code   code as follows:update  ' es_product '  SET  ' pro_pub_time '  =  replace (' pro_pub_time ',  ' years ', '-')  where instr (' Pro_pub_time ', ' year ')  > 0  update  ' es_product '  SET  ' pro_pub_time '  = replace (' pro_pub_time ',  ' month ', '-')   Where instr (' Pro_pub_time ', ' month ')  > 0  replace all ' 2005-04-' This type with ' 2005-04-01 '   copy code   The code is as follows:update  ' es_product '  SET  ' Pro_pub_time '  = concat (  ' pro_pub_time ',  ' 01 ')  where subString_index (  ' pro_pub_time ',  '-',  -1)  =  '  and length (' pro_pub_time ')  > 0 and length (' pro_pub_time ')  > 5  replace All ' 2005-' This type with ' 2005-01-01 '   Copy code   code as follows:update  ' es_product '  SET  ' Pro_pub_time '  = concat (  ' pro_pub_ Time ',  ' 01-01 ')  where instr (' Pro_pub_time ', '-')  > 0 and length (' Pro_pub_ Time ')  = 5  add all   '-', but the number of bits less than 8 is changed to append ' -01 '   copy code   code as follows:update  ' es_product '   set  ' Pro_pub_time '  = concat (  ' pro_pub_time ',  ' -01 ')  where instr (' Pro_pub_ Time ', '-')  > 0 and length (' Pro_pub_time ')  < 8  change All ' 2005 ' to ' 2005-01-01 '   Copy code   code as follows:update  ' es_product '  SET  ' pro_pub_time '  = concat (' Pro_ Pub_time ', ' -01-01 ')  where instr (' Pro_pub_time ', '-')  = 0 and length (' Pro_pub_time ')  = 4  finally will all ' 2005-01-01 ' formatted ' January 2005 '   copy code   code as follows:update  ' es_product '  SET  ' pro_pub_time '  =  Date_format (' Pro_pub_time ', '%y year%m Month ')  where instr (' Pro_pub_time ', '-')  > 0


MySQL Database replacement

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.