0 of the data in front of MySQL, 0 is going to be the problem

Source: Internet
Author: User

Recently due to the needs of the project, the need to frequently pull data from different databases, the process of pulling data, a variety of problems, very sad, really so-called, an oversight, you will be pushed back ...

After many times have been torn down and stand up, and then be torn down after the arduous struggle process, finally completed the data migration, update, synchronization, repair. Summarize some of the issues encountered during this period:

1, MySQL in front of 0 of the data, 0 will be the problem of the shed

Data becomes 371xxx when data is stored in a database of 0371xxx

(1) If the field type must be int, you can modify the field to increase the zero Fill,alter table name modify field name int not null zero fill;

(2) If you do not have to be an int, modify the field type to be a string type, and the field data in the SQL statement must be quoted, without quotation marks, even for string types, the preceding 0 is lost.

2, some data section field error, and a lot of data does not have a typo paragraph has been modified

Add a isexists field to the database, which defaults to 0.

The primary key determines whether the data exists, there are updates to the corresponding fields, there is no insert, UPDATE and insert data isexists set to 1

After the update is complete, delete the data isexists to 0. Delete the Isexists field after confirming that the data is correct.


0 of the data in front of MySQL, 0 is going to be the problem

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.