更新时间:2022-11-08 07:36:35
您可以使用CASE语句。如果我理解正确,你想在参数为空或空的情况下单独保留字段。
简单地做这样的事情:
You can use a CASE statement. If I understand you correctly, you want to leave the field alone if the parameter is null or empty.
Simply do something like this:
UPDATE table1
SET field1 = CASE WHEN COALESCE(@field1, '') = '' THEN field1 ELSE @field1 END