TSQL:将列更新为null

时间:2021-01-01 09:26:18

A learner here. This has to be esasy but I cannot figure it out.

这是一个学习者。这必须是安逸的,但我无法弄清楚。

I have a table like this:

我有这样一张桌子:

ID -- NAME -- CHOICE
1 -- John -- book
2 -- Matt -- pen
3 -- Linda -- bag
.
.

What would be the script to turn all the data in column CHOICE to null?

将CHOICE列中的所有数据转换为null的脚本是什么?

Thanks a ton

万分感谢

1 个解决方案

#1


19  

You'd use an UPDATE statement, without a WHERE clause (so it updates every single row)

你使用UPDATE语句,没有WHERE子句(所以它更新每一行)

UPDATE YourTable
SET Choice = NULL

#1


19  

You'd use an UPDATE statement, without a WHERE clause (so it updates every single row)

你使用UPDATE语句,没有WHERE子句(所以它更新每一行)

UPDATE YourTable
SET Choice = NULL