SQL. Changes require the table to be recreated

There is a table full which contains data. Is it possible to change field from [not null] to [null] without dropping and recreating it? SQL writes that table have to be dropped and recreated. :)


You can try:

alter table YourTable alter column YourColumn int null

Per Martin Smiths comment, a change in nullability does not require a copy of the table. On disk, each row has a nullabiltiy bitmap at the start. I thought the bitmap had to be resized in some cases, but apparently it contains a bit for each column, nullable or not nullable.


您是否尝试过使用ALTER TABLE XXX ALTER COLUMN YYY YOURTYPE NULL命令?


这可能有助于:

ALTER TABLE [Table] ALTER COLUMN [Column] [YourDataType] NULL
链接地址: http://www.djcxy.com/p/76280.html

上一篇: 使用迁移文件更改列?

下一篇: SQL。 更改要求重新创建表