Update Column in table only if variable is Not NULL

2013-10-28 Thread Neil Tompkins
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

Re: Update Column in table only if variable is Not NULL

2013-10-28 Thread Andy Wallace
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

Re: Update Column in table only if variable is Not NULL

2013-10-28 Thread Shawn Green
Hello Neil, On 10/28/2013 2:06 PM, 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 This needs

RE: Change to MySQL Community Server 5.7.2?

2013-10-28 Thread hsv
2013/10/25 00:08 +, Rick James There's an old saying, If it ain't broke, don't fix it. Why _might_ 5.6.x or 5.7.x be better for you? Sure there might be some features you might want, might be some performance improvements that you might notice, etc. And there might be some regressions

Re: Update Column in table only if variable is Not NULL

2013-10-28 Thread Neil Tompkins
Hi Shawn Thanks for your reply. Maybe my example wasn't detailed enough. Basically the snippet of the UPDATE statement I provided shows updating only 1 field. However in my live working example, I have about 20 possible fields that might need to be updated if the variable passed for each field