Go Back   CodingForums.com > :: Server side development > MySQL

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-07-2012, 08:19 AM   PM User | #1
BubikolRamios
Senior Coder

 
Join Date: Dec 2005
Location: Slovenia
Posts: 1,876
Thanks: 114
Thanked 76 Times in 76 Posts
BubikolRamios is on a distinguished road
Data truncated for column ...

Only want to add 'date_observation_for_exact_id_galery' column to index.


Code:
ALTER TABLE `tezaver_place_date`
	DROP PRIMARY KEY,
	ADD PRIMARY KEY (`id_tezaver`, `cc2`, `place_id`, `date_observation`, `micro_location`, `id_galery`, `date_observation_for_exact_id_galery`) USING BTREE;

/* SQL Error (1265): Data truncated for column 'date_observation_for_exact_id_galery' at row 3 */
__________________
Found a flower or bug and don't know what it is ?
agrozoo.net galery
if you don't spot search button at once, there is search form:
agrozoo.net galery search
BubikolRamios is offline   Reply With Quote
Old 09-07-2012, 08:25 AM   PM User | #2
BubikolRamios
Senior Coder

 
Join Date: Dec 2005
Location: Slovenia
Posts: 1,876
Thanks: 114
Thanked 76 Times in 76 Posts
BubikolRamios is on a distinguished road
aparently adding index on 'date_observation_for_exact_id_galery' column, does not work if thee are null values !?


Cant imagine why ewerything else work exept adding index.
__________________
Found a flower or bug and don't know what it is ?
agrozoo.net galery
if you don't spot search button at once, there is search form:
agrozoo.net galery search
BubikolRamios is offline   Reply With Quote
Old 09-07-2012, 01:26 PM   PM User | #3
vroom
New Coder

 
Join Date: Sep 2012
Posts: 71
Thanks: 0
Thanked 8 Times in 8 Posts
vroom is an unknown quantity at this point
Hmm, that's a pretty large primary key.

Do you need all those columns to have a primary key? If you were looking to query efficiently you might create some other indexes for that purpose.

Also, as a primary key, you can only include NOT NULL defined columns.

Quote:
http://dev.mysql.com/doc/refman/5.1/...ate-table.html
A PRIMARY KEY is a unique index where all key columns must be defined as NOT NULL. If they are not explicitly declared as NOT NULL, MySQL declares them so implicitly (and silently). A table can have only one PRIMARY KEY. The name of a PRIMARY KEY is always PRIMARY, which thus cannot be used as the name for any other kind of index.
vroom is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:07 AM.


Advertisement
Log in to turn off these ads.