List:General Discussion« Previous MessageNext Message »
From:hsv Date:October 30 2013 1:52am
Subject:Re: Update Column in table only if variable is Not NULL
View as plain text  
>>>> 2013/10/29 11:35 -0400, Shawn Green >>>>
My favorite technique is the COALESCE function for this on a column-by-column basis

SET FieldName1 = Now(), FieldName2 = COALESCE(:MyVariable, FieldName2) 
<<<<<<<<
but if MyVariable is NULL, FieldName1 reflects the attempt to change, not change.

Thread
Update Column in table only if variable is Not NULLNeil Tompkins28 Oct
  • Re: Update Column in table only if variable is Not NULLAndy Wallace28 Oct
  • Re: Update Column in table only if variable is Not NULLShawn Green28 Oct
    • Re: Update Column in table only if variable is Not NULLNeil Tompkins28 Oct
      • Re: Update Column in table only if variable is Not NULLMichael Dykman29 Oct
      • Re: Update Column in table only if variable is Not NULLShawn Green29 Oct
        • Re: Update Column in table only if variable is Not NULLhsv30 Oct
          • Re: Update Column in table only if variable is Not NULLShawn Green30 Oct
            • Re: Update Column in table only if variable is Not NULLNeil Tompkins30 Oct
              • Re: Update Column in table only if variable is Not NULLShawn Green30 Oct
      • Re: Update Column in table only if variable is Not NULLhsv29 Oct