- Where Developers Learn, Share, & Build Careers
I can choose which fields in my table are updated by the stored procedure based on the value of the input parameters has gone. If the input field is equal to 'draft', then it should update id_draft , otherwise it should update id . Is this possible? This is one of my failed attempts which can explain what I want to do: You can not use the CASE statement to change the query structure itself, it only gives first, this is a function. You must have either <<>> id_draft ELSE id END ) in value if the input_field = 'draft' Code> id field or Instead, you have to enter the CAS statement from the right hand side ... But, in fact, you can be better off doing this ... Edit: * To use a value from another table instead of just
Create or change process SP_test (input_field VARCHAR defaults NULL) Issue of the IS BEGIN update table set when input_field = 'draft' then the id_draft ELSE id = 'X'
id_draft field. It is like doing this ...
Update your Tables STT case when 'abc' = 'draft' then 123 ELSE 789 END = 'x'
Update your own ATT ID = case when input_field = 'draft' then idE 'ELSE' end, id_draft = Enter Input_field = 'draft' THEN 'x' ELSE id_draft END
if (input_field = 'draft Update your TABEt id_draft = 'x' ELSE Update your table SET id = 'x'
'x' , you can use something like this ...
your Table SET ID = Update the case when input_field = 'draft' then yourTable.id ELSE otherTable.x END, id_draft = case when input_file = 'draft' then other. Table.x ELSE yourTable.id_draft other than ENDTable where otherTable.a =? And otherTable.b =?
Comments
Post a Comment