mii
mii

Reputation: 601

Mysql Warning Question?

I inserted some info into my mysql database and I got the following error listed below. What does this mean and how can I fix it?

1 row(s) inserted.
Inserted row id: 1
Warning: #1265 Data truncated for column 'summary' at row 1

Here is my Mysql tables structure below.

CREATE TABLE mem_articles (
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
member_id INT UNSIGNED NOT NULL,
title VARCHAR(255) NOT NULL,
summary VARCHAR(255) DEFAULT NULL,
content LONGTEXT NOT NULL,
date_created DATETIME NOT NULL,
date_updated DATETIME DEFAULT NULL,
PRIMARY KEY (id)
);

Upvotes: 1

Views: 5798

Answers (3)

KullDox
KullDox

Reputation: 353

I would suggest setting the type to "longtext" or something larger.

Upvotes: 1

MarkR
MarkR

Reputation: 63538

It means that the data were "truncated", which in MySQL terminology means either it was truncated, or it was changed into something totally different if it was incompatible with the type.

This behaviour sucks; if you don't want it, use

SET SQL_MODE='TRADITIONAL'

Then it will behave like a sensible database (unfortunately this will probably break your entire code base if it's an existing application)

Upvotes: 1

meder omuraliev
meder omuraliev

Reputation: 186562

I think it means that the amount of characters you attempted to insert into the summary column exceeded 255, perhaps you should alter it to be TEXT instead of VARCHAR(255).

http://dev.mysql.com/doc/refman/5.1/en/alter-table.html

Upvotes: 5

Related Questions