How to change column datatype in SQL database without losing data

前端 未结 11 2603
迷失自我
迷失自我 2020-12-02 06:55

I have SQL Server database and I just realized that I can change the type of one of the columns from int to bool.

How can I do that withou

11条回答
  •  难免孤独
    2020-12-02 07:06

    if you use T-SQL(MSSQL); you should try this script:

    ALTER TABLE [Employee] ALTER COLUMN [Salary] NUMERIC(22,5)
    

    if you use MySQL; you should try this script:

    ALTER TABLE [Employee] MODIFY COLUMN [Salary] NUMERIC(22,5)
    

    if you use Oracle; you should try this script:

    ALTER TABLE [Employee] MODIFY [Salary] NUMERIC(22,5)
    

提交回复
热议问题