PROGRAMMING/DataBase

[MySQL] 컬럼속성변경 오류해결방법_ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CURRENT_TIMESTAMP' at line 1

seulda 2021. 6. 14. 14:33
728x90

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CURRENT_TIMESTAMP' at line 1

 

▶︎ table 컬럼의 타입을 변경하고 싶을 때

ALTER TABLE tableName MODIFY columnName 변경할TYPE;

▶︎ table 컬럼의 default를 설정/수정하고 싶을 때

ALTER TABLE tableName ALTER COLUMN columnName SET DEFAULT 설정할값;

타입 변경, 디폴트 설정 중 에러 발생

 

▶︎ defalut 값 설정 변경 시 발생 에러

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CURRENT_TIMESTAMP' at line 1

해결 방법 -> 설정할 디폴트 값에 괄호 추가!

(생각보다 간단합니다,,!)

 

괄호로 해결

 

 

 

굿럭! 열공!

728x90