UPDATE Contact
SET MobilePhone = WorkPhone
WHERE left(WorkPhone, 2) LIKE '%01%'
and MobilePhone = NULL and User = 992;
答案 0 :(得分:1)
您可以尝试以下操作-您需要添加MobilePhone is NULL
而不是MobilePhone = NULL
UPDATE Contact
SET MobilePhone = WorkPhone
WHERE left(WorkPhone, 2) LIKE '08%'
and MobilePhone is NULL and User = 992;
答案 1 :(得分:1)
这是您想要的吗?
UPDATE Contact
SET MobilePhone = WorkPhone
WHERE WorkPhone LIKE '08%' AND -- WorkPhone starts with "08"
MobilePhone IS NULL AND -- Probably your real problem
User = 992;
仅将LIKE
用于“开头为”。您的标题为“ 08”,因此使用了它。
您真正的问题可能是= NULL
,因为它永远不会返回true,因此不会更新任何行。