SQL: Change data type of a column



    The code alter table Employees alter column BirthDate year to change the data type of the column from text to date.

    ALTER TABLE table_name
    ALTER COLUMN column_name datatype;
    ALTER TABLE [schema_name.]table_name
    ALTER COLUMN <column_name> TYPE <new_data_type>,
    ALTER COLUMN <column_name> TYPE <new_data_type>
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.