[英]Updating a column to NULL returns empty column
When I run this query 当我运行此查询时
UPDATE tblPlayer
SET Salary = NULL,
Status = "1"
WHERE PlayerId=123
Instead of updating salary to NULL
the it updates to an empty value 而不是将薪水更新为
NULL
,而是更新为空值
How do I get NULL
instead of empty value? 如何获取
NULL
而不是空值?
Your code is working fine with me 您的代码对我来说很好
UPDATE tblPlayer
SET Salary = NULL,
Status = '1'
WHERE PlayerId = 123
I bet your SALARY
has default value ''
我敢打赌您的
SALARY
具有默认值''
To alter the column, try this DDL 要更改列,请尝试此DDL
ALTER TABLE tblPlayer MODIFY Salary VARCHAR(15) NULL DEFAULT NULL;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.