SQLTeam.com | Weblogs | Forums

Update table1 using 2 tabels


#1

Hi

how to update column if two column is null or empty.
UPDATE tHLIntimationLetter_Cust SET UD_RejectionReason =
(CASE WHEN ( UD_Category2='Null') and ( Address1='Null') then
'COMMUNICATION & BUSSINESS ADRESS IS NOT FOUND' end)
FROM tHLIntimationLetter_Cust B
when I using this wrong updating


#2

Try this:

update b
   set b.UD_RejectionReason='COMMUNICATION & BUSSINESS ADRESS IS NOT FOUND'
  from tHLIntimationLetter_Cust as b
 where isnull(b.UD_Category2,'')=''
   and isnull(b.Address1,'')=''