0

I have a table where I need to find and update the status id if the specific columns are empty or NULL.

I need to check columns Like Phone and Email if its value is empty or NULL, the Status should be updated to 2.

UserTbl

I tried this query:

select * from UserTbl where NULL in(Email, Phone)

As the column values are empty, I am not getting any result.

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
PKJI
  • 41
  • 5

2 Answers2

0

This would do it:

UPDATE UserTbl
SET StatusId=2 
WHERE 
      (ISNULL(Phone) OR Phone='')
  AND (ISNULL(Email) OR Email='');
Alexander van Oostenrijk
  • 4,644
  • 3
  • 23
  • 37
0

Try this -

UPDATE <TableName> 
SET StatusId = 2
WHERE (ISNULL(Phone) OR Phone = '') AND (ISNULL(Email) OR Email= '')
Dhilip H
  • 594
  • 4
  • 10