SQL if not null update

前端 未结 5 1702
忘掉有多难
忘掉有多难 2021-01-26 03:18

I have this query

UPDATE users SET username = Param1,email = Param2,PASSWORD = Param3 WHERE id = Param4;

this is updating my user row, but

5条回答
  •  旧巷少年郎
    2021-01-26 03:45

    UPDATE users 
    SET username = Param1,
    email = Param2,
    PASSWORD = Param3 
    WHERE id = Param4 AND (ISNULL(email,'') != '' OR ISNULL(PASSWORD, '') != '');
    

提交回复
热议问题