Newbie
Newbie

Reputation: 771

setting a value using ISNULL?

I know this is simple but I really need to make sure what I understood is indeed correct.

Is the below code setting the value of A.FUTUREUSE09 to 'not available' if DS.[FUTUREUSE09] IS NULL?

UPDATE A  
   SET  
       A.[FUTUREUSE09] = ISNULL(DS.[FUTUREUSE09] , 'not available')  
       ----------  
       -----------  
       -----------  
       -----------  
FROM PRODUCT A JOIN DS_PRODUCTS DS  
ON A.ID = DS.ID  
JOIN HIERARCHY H ON   
                            CASE      
                             WHEN DS.CODE = 'not available' THEN 'NA_PL3'  
                             ELSE DS.CODE  
                            END = H.CODE;  

Upvotes: 1

Views: 63

Answers (1)

Aditya Singh
Aditya Singh

Reputation: 16660

Yes. It will. ISNULL takes 2 parameters: First is a check_expression and second is replacement_value. It returns the first check_expression if it is not null else it returns replacement_value, in your case not available

Upvotes: 3

Related Questions