MySQL batch update data solution ideas

Source: Internet
Author: User
MySQL Batch update data
My database has a ydd field, and the values in the fields are similar: 5456 Huainan District
I want to filter out the numbers in the field in the MySQL batch.
How does it come true, please?

------Solution--------------------
The first time to write MySQL function, dedicated to the landlord you ~ very stupid method to achieve
SQL Code
SET GLOBAL log_bin_trust_function_creators=true;drop function IF EXISTS num_fiter; CREATE FUNCTION num_fiter (input varchar (255))  RETURNS varchar (255) BEGIN    DECLARE i INT;    DECLARE length INT;        DECLARE current VARCHAR (1);    DECLARE temp VARCHAR (255);    SET i=0;    SET temp= ";    SET length=length (input);    While I <= length does        SET current=substr (input from I for 1);        IF current REGEXP ' [0-9] ' then            SET current= ';        END IF;        SET Temp=concat (temp,current);        SET i=i+1;    END while;    RETURN temp; END; SELECT num_fiter (' 5456 Huainan District ');
  • 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.