Home  >  Article  >  Database  >  What does it mean to truncate string or binary data

What does it mean to truncate string or binary data

醉折花枝作酒筹
醉折花枝作酒筹Original
2021-07-13 13:59:2140679browse

The added restrictions of truncating string or binary data conflict with the data already stored in the database. This can only be solved by modifying all the data outside the restrictions in the database to data that meets the restrictions, or adjusting the restrictions.

What does it mean to truncate string or binary data

The operating environment of this tutorial: windows7 system, mysql8 version, Dell G3 computer.

In EF, when using CodeFirst to add constraints to an entity, use the NeGut console to update it into the database. First use the add-migration migrationName command to create it (migrationName is the name to be updated), and then use Update -Database is updated to the database, and a problem is reported at this time:

will truncate string or binary data.

The statement has been terminated.

Error reason

Why is this problem reported? The reason is that the added restrictions and the data already stored in the database are conflict.

For example, if the user ID is limited to numbers, but there are unexpected numbers in the user ID in the database, this error will be reported.

Solution

The solution is to modify all the data outside the restrictions in the database to data that meets the restrictions, or adjust the restrictions

Related recommendations: "mysql tutorial"

The above is the detailed content of What does it mean to truncate string or binary data. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn