SQL/Redshift
Redshift : values too long for type character varying error 해결하기
CosmosProject
2021. 6. 16. 12:57
728x90
반응형
table을 생성하고 insert into로 데이터를 insert하거나 update를 할 때 아래와 같은 에러가 발생할 수 있습니다.
values too long for type character varying
위 에러는 table에 있는 column의 최대 길이보다 insert 또는 update할 값의 길이가 더 길어서 값을 담지 못할 때 발생합니다.
이런 경우 alter table, alter column을 이용하여 column의 최대 길이를 늘려주면 됩니다.
Syntax는 아래와 같습니다.
alter table table_name
alter column column_name type data_type
;
alter table main.items
alter column item_name type varchar(max)
;
위 예시는
main.items table에 존재하는 item_name column의 data type을
varchar(max)로 변경합니다.
728x90
반응형