How do I alter the precision of a decimal column in Sql Server?

前端 未结 5 802
野性不改
野性不改 2020-12-25 09:18

Is there a way to alter the precision of an existing decimal column in Sql Server?

5条回答
  •  一向
    一向 (楼主)
    2020-12-25 09:47

    ALTER TABLE Testing ALTER COLUMN TestDec decimal(16,1)
    

    Just put decimal(precision, scale), replacing the precision and scale with your desired values.

    I haven't done any testing with this with data in the table, but if you alter the precision, you would be subject to losing data if the new precision is lower.

提交回复
热议问题