“数据对于列而言太长"; - 为什么? [英] "Data too long for column" - why?
本文介绍了“数据对于列而言太长"; - 为什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经编写了一个MySQL脚本来创建用于假设的医院记录的数据库,并用数据填充它.其中一个表Department有一列名为Description的列,该列声明为varchar(200)类型.为说明执行INSERT命令时,出现错误:
I've written a MySQL script to create a database for hypothetical hospital records and populate it with data. One of the tables, Department, has a column named Description, which is declared as type varchar(200). When executing the INSERT command for Description I get an error:
错误1406:第1行的说明"列的数据太长.
error 1406: Data too long for column 'Description' at row 1.
我要插入的所有字符串均少于150个字符.
All the strings I'm inserting are less than 150 characters.
这是声明:
CREATE TABLE Department(
...
Description varchar(200)
...);
这是插入命令:
INSERT INTO Department VALUES
(..., 'There is some text here',...), (..., 'There is some more text over here',...);
从所有方面来看,这都应该起作用.有人有见识吗?
By all appearances, this should be working. Anyone have some insight?
推荐答案
将列类型更改为LONGTEXT
这篇关于“数据对于列而言太长"; - 为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文