Forum Discussion

Ravi_008's avatar
Ravi_008
Copper Contributor
Nov 20, 2022

ISNull

Hey, 

 

I just wanted to update the Null address with the Owneraddress, I'm using ISNULL(Propertyaddress, Owneraddress) but this syntax has updated the Entire Owneraddress.

Though I've tested this Code with a sample data and it's working fine.  Just want to understand why this is behaving this way?

Code : 

Update Nashville
set Propertyaddress = Isnull(Propertyaddress, Owneraddress)
From Nashville$

 

Regards

Ravi

1 Reply

  • SnowMan55's avatar
    SnowMan55
    Bronze Contributor

    Ravi_008 I suspect that your problem is that you included the "FROM Nashville" clause; remove it.

     

    But then you are still updating every row; the rows that contain non-null values for PropertyAddress are still updated, though unchanged, and that results in extra log entries, etc.  A better query would update just those rows that have null values:

    Update Nashville
        Set PropertyAddress = OwnerAddress
        Where PropertyAddress Is Null
    ;

     

Resources