How to convert column type from varchar to date in PostgreSQL?

前端 未结 4 987
盖世英雄少女心
盖世英雄少女心 2020-12-30 03:21

I have varchar data type column and date data type column.

I have to update varchar column data into date column

4条回答
  •  隐瞒了意图╮
    2020-12-30 04:11

    syntax for typecasting:

    alter table table_name alter column_name 
       type converting_data_type using(column_name::converting_data_type)
    

    converting from varchar to date

    alter table table_name 
      alter column_name type date using(column_name::date)
    

提交回复
热议问题