2017-02-25 51 views
0
ALTER TABLE birds_new 
MODIFY COLUMN endangered ENUM(
     'Extinct', 
     'Extinct in Wild', 
     'Threatened - Critically Endangered', 
     'Threatened - Endangered', 
     'Threatened - Vulnerable', 
     'Lower Risk - Conservation Dependent', 
     'Lower Risk - Near Threatened', 
     'Lower Risk - Least Concern') 
AFTER famliy_id 

ERROR:Data truncated for column 'endangered' at row 1 befor this change, endangered use BIT(1)MySQL錯誤發生了:數據被截斷列「瀕危」第1行

回答

0

我遇到了同樣的問題,而與羅素J.T.寫了一本書學習的MySQL戴爾,你只需要更新瀕危列所有記錄設置爲1

UPDATE birds_new SET endangered = 1; 

,那麼你可以改變列瀕危,

ALTER TABLE birds_new 
MODIFY COLUMN endangered ENUM (
    'Extinct' 
    ,'Extinct in Wild' 
    ,'Threatened - Critically Endangered' 
    ,'Threatened - Endangered' 
    ,'Threatened - Vulnerable' 
    ,'Lower Risk - Conservation Dependent' 
    ,'Lower Risk - Near Threatened' 
    ,'Lower Risk - Least Concern' 
) AFTER family_id; 
相關問題