问题:
I have a table that has several nullable integer columns. 我有一个表有几个可以为空的整数列。 This is undesirable for several reasons, so I am looking to update all nulls to 0 and then set these columns to NOT NULL . 由于多种原因,这是不可取的,因此我希望将所有空值更新为0,然后将这些列设置为NOT NULL 。 Aside from changing nulls to 0 , data must be preserved. 除了将空值更改为0 ,还必须保留数据。
I am looking for the specific SQL syntax to alter a column (call it ColumnA ) to " not null ". 我正在寻找特定的SQL语法来将列(称为ColumnA )更改为“ not null ”。 Assume the data has been updated to not contain nulls. 假设数据已更新为不包含空值。
Using SQL server 2000 . 使用SQL Server 2000 。
解决方案:
参考一: https://stackoom.com/question/2tQw/更改列-null为非null参考二: https://oldbug.net/q/2tQw/Altering-a-column-null-to-not-null
来源:oschina
链接:https://my.oschina.net/u/4438370/blog/4493517