casting - Change data type varchar to timestamp along with null values in PostgreSQL -


change data type varchar timestamp along null values in postgresql have column empty rows , few timestamp rows. how convert timestamp data type in postgresql?

you need using clause turn empty strings null.

alter table ...    alter column mycol      type timestamp      using (...conversion expression...) 

without seeing input data it's hard expression must be, involves nullif or case expressions , to_timestamp function and/or cast timestamp.


Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -