Is there any way for setting all the rows of a column to a null value? thanks
有没有办法将列的所有行设置为空值?谢谢
2 个解决方案
#1
5
How about something simple like : Update MyTable Set MyColumn = NULL
简单的事情怎么样:更新MyTable设置MyColumn = NULL
Or, did you mean you wanted to set all columns in a row to NULL? If so, you have a database design problem. You should greatly limit what columns in a database accept NULL values.
或者,您是否想要将一行中的所有列设置为NULL?如果是这样,您就遇到了数据库设计问题。您应该大大限制数据库中的哪些列接受NULL值。
#2
5
Sure.
UPDATE table SET column = NULL
If you don't include a WHERE
clause, the statement will affect all the rows in the table.
如果不包含WHERE子句,则该语句将影响表中的所有行。
#1
5
How about something simple like : Update MyTable Set MyColumn = NULL
简单的事情怎么样:更新MyTable设置MyColumn = NULL
Or, did you mean you wanted to set all columns in a row to NULL? If so, you have a database design problem. You should greatly limit what columns in a database accept NULL values.
或者,您是否想要将一行中的所有列设置为NULL?如果是这样,您就遇到了数据库设计问题。您应该大大限制数据库中的哪些列接受NULL值。
#2
5
Sure.
UPDATE table SET column = NULL
If you don't include a WHERE
clause, the statement will affect all the rows in the table.
如果不包含WHERE子句,则该语句将影响表中的所有行。