How to change column datatype in SQL database without losing data

前端 未结 11 2520
迷失自我
迷失自我 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:02

    Why do you think you will lose data? Simply go into Management Studio and change the data type. If the existing value can be converted to bool (bit), it will do that. In other words, if "1" maps to true and "0" maps to false in your original field, you'll be fine.

提交回复
热议问题