• SET @ADR3 = 'null'

    That's setting the variable to the string value n-u-l-l. If you want to check whether a variable has the string value "null", then you'd need IF @Adr3 = "Null"

    If you want to set and check for the absence of a value (NULL), then it's

    SET @Adr3 = NULL

    IF @Adr3 IS NULL ...

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass