• <legend id='BUGEQ'><style id='BUGEQ'><dir id='BUGEQ'><q id='BUGEQ'></q></dir></style></legend>
    1. <small id='BUGEQ'></small><noframes id='BUGEQ'>

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

        <bdo id='BUGEQ'></bdo><ul id='BUGEQ'></ul>

      1. 错误代码:1406.列的数据太长 - MySQL

        Error Code: 1406. Data too long for column - MySQL(错误代码:1406.列的数据太长 - MySQL)
        <tfoot id='Dqbxf'></tfoot>

            <tbody id='Dqbxf'></tbody>

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

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

                  本文介绍了错误代码:1406.列的数据太长 - MySQL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  错误代码:1406.列的数据太长

                  Error Code: 1406. Data too long for column

                  CREATE  TABLE `TEST` 
                  (
                  
                    `idTEST` INT NOT NULL ,
                  
                    `TESTcol` VARCHAR(45) NULL ,
                  
                    PRIMARY KEY (`idTEST`) 
                  );
                  

                  现在插入一些值

                  INSERT INTO TEST
                  VALUES
                  (
                      1,
                      'Vikas'
                  )
                  
                  select 
                  
                  SELECT * FROM TEST;
                  

                  插入超过长度

                  INSERT INTO TEST
                  VALUES
                  (
                      2,
                      'Vikas Kumar Gupta Kratika Shukla Kritika Shukla'
                  )
                  

                  如果我们select length

                  SELECT LENGTH('Vikas Kumar Gupta Kratika Shukla Kritika Shukla')
                  
                   '47'
                  

                  它显示错误信息

                  错误代码:1406.列的数据太长

                  但我的期望是,我想在表格中至少插入前 45 个字符

                  But what is my expectation is, I want to insert at least first 45 characters in Table

                  如果问题不清楚,请告诉我.

                  please let me know if the question is not clear.

                  我知道这个错误的原因.我试图插入超过数据类型长度的值.

                  I know the cause of this error. I am trying to insert values more than the length of datatype.

                  我想要在 MySQL 中的解决方案,因为它可以在 MS SQL 中实现.所以我希望它也能在 MySQL 中.

                  I want solution in MySQL as It is possible in MS SQL. So I hope it would also be in MySQL.

                  推荐答案

                  MySQL 将截断任何超过指定列宽的插入值.

                  MySQL will truncate any insert value that exceeds the specified column width.

                  要做到这一点,请尝试将您的 SQL 模式 切换为不使用 STRICT.

                  to make this without error try switch your SQL mode to not use STRICT.

                  Mysql 参考手册

                  改变模式

                  这可以通过两种方式完成:

                  This can be done in two ways:

                  1. 在 MySQL 安装目录中打开您的 my.ini (Windows) 或 my.cnf (Unix) 文件,并查找文本sql-mode".
                  1. Open your my.ini (Windows) or my.cnf (Unix) file within the MySQL installation directory, and look for the text "sql-mode".

                  查找:

                  代码:

                  # Set the SQL mode to strict 
                  sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
                  

                  替换为:

                  代码:

                  # Set the SQL mode to strict 
                  sql-mode="NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
                  

                  1. 您可以在数据库管理工具(例如 phpMyAdmin)中运行 SQL 查询:

                  代码:

                  SET @@global.sql_mode= '';
                  

                  这篇关于错误代码:1406.列的数据太长 - MySQL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  ibtmp1是非压缩的innodb临时表的独立表空间,通过innodb_temp_data_file_path参数指定文件的路径,文件名和大小,默认配置为ibtmp1:12M:autoextend,也就是说在文件系统磁盘足够的情况下,这个文件大小是可以无限增长的。 为了避免ibtmp1文件无止境的暴涨导致
                  SQL query to group by day(按天分组的 SQL 查询)
                  What does SQL clause quot;GROUP BY 1quot; mean?(SQL 子句“GROUP BY 1是什么意思?意思是?)
                  MySQL groupwise MAX() returns unexpected results(MySQL groupwise MAX() 返回意外结果)
                  MySQL SELECT most frequent by group(MySQL SELECT 按组最频繁)
                  Include missing months in Group By query(在 Group By 查询中包含缺失的月份)

                  <small id='42NlR'></small><noframes id='42NlR'>

                    <tbody id='42NlR'></tbody>

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

                          • <bdo id='42NlR'></bdo><ul id='42NlR'></ul>