更改列:null为非null

这一生的挚爱 提交于 2020-08-14 12:19:01

问题:

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
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!