Is it possible to use a case statement to choose the column to update? For instance, in the following example I have 4 columns. I want the parameter @p_name to go into the first non-null column of those 4:
This returns the error "Incorrect syntax near the keyword 'case'". Do I have the syntax wrong, or is this just not possible?
Thanks in advance...
mwa
<><
Code:
update InterviewSlots
set case when isnull(slot1_reserved_by,'')= '' then
slot1_reserved_by
when isnull(slot2_reserved_by,'')= '' then
slot2_reserved_by
when isnull(slot3_reserved_by,'')= '' then
slot3_reserved_by
when isnull(slot4_reserved_by,'')= '' then
slot4_reserved_by
end = @p_name
where time_slot_start = @p_date
Thanks in advance...
mwa
<><