List:General Discussion« Previous MessageNext Message »
From:Andy Wallace Date:October 28 2013 6:16pm
Subject:Re: Update Column in table only if variable is Not NULL
View as plain text  
Try:

update my_table
set fieldname1 = Now(), Fieldname2 = :myVariable
where Fieldname3 is not null



On 10/28/13 11:06 AM, Neil Tompkins wrote:
> Hi
>
> If I have a update statement like
>
> UPDATE MY_TABLE
> SET FieldName1 = Now(), FieldName2 = :MyVariable
> WHERE FieldName3 = 'Y'
>
> How can I only update the FieldName2 field if the value of MyVariable is
> NOT NULL ?
>
> Thanks
> Neil
>

-- 
Andy Wallace
iHOUSEweb, Inc.
awallace@stripped
(866) 645-7700 ext 219
--
"Sometimes it pays to stay in bed on Monday, rather than spending the rest of the week
debugging Monday's code."
- Christopher Thompson
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