Add NOT NULL to a column in SQL

I have the following column

 `Equipamento_Solucao_id` VARCHAR(32) NOT NULL,

I would like it to be

`Equipamento_Solucao_id` VARCHAR(32) DEFAULT NULL,

How can I do this without changing my database model, that is, with a sql query?


You would use an alter table statement. A typical method would be:

alter table t alter column Equipamento_Solucao_id VARCHAR(32) DEFAULT NULL;

You could also look through the system tables on your database, find the not-null constraint, and then drop it specifically.

链接地址: http://www.djcxy.com/p/76296.html

上一篇: 水平变换表格,需要时填充NULL列

下一篇: 在SQL中向列添加NOT NULL