SQL Query to Change Column DataType

Hello community

Can someone let me know if there is a sql query that I can run to change the column datatype.

For example, I would like to change column or column's from 'string' to 'integer.



alter table


Thanks for reaching out. I will google 'alter table', however could you write it in context of changing a column datatype please

alter table yourtable
 alter column yourcolumn varchar(64) not null
1 Like

Might be best to

  1. Create a new column
  2. Update its content using data from columm you want changed
  3. Compare results and verify
  4. Rename old colun to columnname_old
  5. Rename new column name to oldcolumnname
1 Like