<bdo id='wiZ6H'></bdo><ul id='wiZ6H'></ul>
    1. <small id='wiZ6H'></small><noframes id='wiZ6H'>

    2. <i id='wiZ6H'><tr id='wiZ6H'><dt id='wiZ6H'><q id='wiZ6H'><span id='wiZ6H'><b id='wiZ6H'><form id='wiZ6H'><ins id='wiZ6H'></ins><ul id='wiZ6H'></ul><sub id='wiZ6H'></sub></form><legend id='wiZ6H'></legend><bdo id='wiZ6H'><pre id='wiZ6H'><center id='wiZ6H'></center></pre></bdo></b><th id='wiZ6H'></th></span></q></dt></tr></i><div id='wiZ6H'><tfoot id='wiZ6H'></tfoot><dl id='wiZ6H'><fieldset id='wiZ6H'></fieldset></dl></div>

      <tfoot id='wiZ6H'></tfoot><legend id='wiZ6H'><style id='wiZ6H'><dir id='wiZ6H'><q id='wiZ6H'></q></dir></style></legend>

      MySQL太长的varchar截断/错误设置

      时间:2023-06-02
        <tbody id='QcEd7'></tbody>
        • <bdo id='QcEd7'></bdo><ul id='QcEd7'></ul>

        • <i id='QcEd7'><tr id='QcEd7'><dt id='QcEd7'><q id='QcEd7'><span id='QcEd7'><b id='QcEd7'><form id='QcEd7'><ins id='QcEd7'></ins><ul id='QcEd7'></ul><sub id='QcEd7'></sub></form><legend id='QcEd7'></legend><bdo id='QcEd7'><pre id='QcEd7'><center id='QcEd7'></center></pre></bdo></b><th id='QcEd7'></th></span></q></dt></tr></i><div id='QcEd7'><tfoot id='QcEd7'></tfoot><dl id='QcEd7'><fieldset id='QcEd7'></fieldset></dl></div>

            <small id='QcEd7'></small><noframes id='QcEd7'>

          1. <tfoot id='QcEd7'></tfoot>

              <legend id='QcEd7'><style id='QcEd7'><dir id='QcEd7'><q id='QcEd7'></q></dir></style></legend>
                本文介绍了MySQL太长的varchar截断/错误设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我有两个 MySQL 实例.当数据太长时,第一个在插入时截断字符串.第二个引发错误:

                I have two MySQL instances. The 1st one truncates strings on insert when data is too long. The 2nd one raises an error:

                ERROR 1406 (22001): 第 1 行 'xxx' 列的数据太长

                我希望第二个也截断数据.是否有任何 MySQL 设置来管理此行为?

                I want the 2nd one to truncate the data as well. Is there any MySQL setting to manage this behavior?

                推荐答案

                您可以禁用 STRICT_TRANS_TABLESSTRICT_ALL_TABLES.这允许自动截断插入的字符串.

                You can disable STRICT_TRANS_TABLES and STRICT_ALL_TABLES. This allows the automatic truncation of the inserted string.

                引用自 MySQL 文档.

                严格模式控制 MySQL 如何处理无效或缺失值数据更改语句,例如 INSERT 或 UPDATE.一个值可以是由于多种原因无效.例如,它可能有错误的数据列的类型,否则可能超出范围.缺少一个值当要插入的新行不包含非 NULL 值时在其定义中没有显式 DEFAULT 子句的列.(为一个NULL 列,如果缺少值则插入 NULL.)

                Strict mode controls how MySQL handles invalid or missing values in data-change statements such as INSERT or UPDATE. A value can be invalid for several reasons. For example, it might have the wrong data type for the column, or it might be out of range. A value is missing when a new row to be inserted does not contain a value for a non-NULL column that has no explicit DEFAULT clause in its definition. (For a NULL column, NULL is inserted if the value is missing.)

                参考:MySQL Server SQL模式

                这篇关于MySQL太长的varchar截断/错误设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:MySQL密码功能 下一篇:漏洞?#1146 - 表 'xxx.xxxxx' 不存在

                相关文章

                    <i id='2rX3A'><tr id='2rX3A'><dt id='2rX3A'><q id='2rX3A'><span id='2rX3A'><b id='2rX3A'><form id='2rX3A'><ins id='2rX3A'></ins><ul id='2rX3A'></ul><sub id='2rX3A'></sub></form><legend id='2rX3A'></legend><bdo id='2rX3A'><pre id='2rX3A'><center id='2rX3A'></center></pre></bdo></b><th id='2rX3A'></th></span></q></dt></tr></i><div id='2rX3A'><tfoot id='2rX3A'></tfoot><dl id='2rX3A'><fieldset id='2rX3A'></fieldset></dl></div>
                      <bdo id='2rX3A'></bdo><ul id='2rX3A'></ul>
                  1. <small id='2rX3A'></small><noframes id='2rX3A'>

                  2. <legend id='2rX3A'><style id='2rX3A'><dir id='2rX3A'><q id='2rX3A'></q></dir></style></legend>
                  3. <tfoot id='2rX3A'></tfoot>