본문 바로가기
Database

[MySql] 컬럼 not null로 변경시 Invalid user of NULL value 발생

by 인기쟁이 돌고래 2023. 2. 21.

modify column으로 nullable컬럼 > not null로 변경하려고 했는데.. ErrorCode:1138 Invalid use of NULL value 오류발생

 

혹시 해당컬럼에 null이 있나...? 찾아봤는데 없음.

 

아무리 봐도 모르겠어서.. 혹시 유령 컬럼이 있나 싶어서 update를 해줘보았음

update [테이블명] set [컬럼명] = 0 where [컬럼명] is null;

읭...? 1건...? 유령...?

 

 

(컬럼 변경) 아주 잘됨 ^_ㅠ ?

alter table [테이블명] modify column [컬럼명] [컬럼타입] not null;

ex)alter table tmp_table modify column rev_id bigint(20) unsigned not null default 0 COMMENT '이력 revision 아이디';

'Database' 카테고리의 다른 글

[Mysql] Primary Key 변경  (0) 2023.02.21
[Mac] redis-cli사용해서 원격 redis에 접속하기  (0) 2021.09.28

댓글