November 30, 2015 at 4:00 am
I have a business requirement where I have to check some conditions are satisfied from table A
then I have to check the records in Table B that are affected because of Table A conditions and then
update /insert Table B columns. I also have to calculate few columns before I insert in Table B.
Also I have a separate table C where I have to record the original values for some columns from table B and then the changed values after insertion/updating.
What I can think of is using a temptable and then use a while loop to perform all insertion or updating whatever applicable.
Is there a better way to achieve this rather than While loop like with SET operations. Since there are lots of operation I need to do for each row of temp table I thought looping is the only solution.
Thanks,
November 30, 2015 at 4:04 am
We can't see your screen, so it's impossible to envisage your requirement. From what you describe, though, it sounds as if you need a MERGE statement to do your inserts and updates to table B, with an OUTPUT clause to send to table C.
John
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply