SQL Server (2016) Changing INT to BIGINT

bpsygsoo  于 2023-06-28  发布在  SQL Server
关注(0)|答案(1)|浏览(163)

When changing an INT column to a BIGINT column on a table with over a 1 billion rows, is it still best practice to create a new table and then migrate the data, or is an ALTER COLUMN just as effective these days?

Not overly worried about downtime.

gg58donl

gg58donl1#

is it still best practice to create a new table and then migrate the data,

That's just a workaround for running out of log space, or excessive blocking, or rollback time in case of failure. So if you've got plenty of time and resources, just ALTER the table.

Just be aware that once you start the ALTER TABLE you're committed to let it finish or wait a possibly long time for it to roll back if you cancel it.

Bulk loading a new table can be aborted with little cost, as only the extent allocations need to be rolled back.

相关问题