“Prevent saving changes that require the table to be re-created” negative effects

前端 未结 5 860
抹茶落季
抹茶落季 2020-12-04 06:00

Preamble

I was modifying a column in SQL Server 2008 today, changing the datatype from something like currency(18,0) to (19,2).

I got the

5条回答
  •  情话喂你
    2020-12-04 06:44

    SQL Server drops and recreates the tables only if you:

    • Add a new column
    • Change the Allow Nulls setting for a column
    • Change the column order in the table
    • Change the column data type

    Using ALTER is safer, as in case the metadata is lost while you re-create the table, your data will be lost.

提交回复
热议问题