• Vincy-856784 (5/21/2010)


    No, I cannot use function becuse if I understood correctly I cannot have Insert/update/Deletes in a scalar function OR may be in any function???

    So, if I inderstand you correctly, your GetCalculatedBonus procedure has sideeffects - meaning that it inserts/updates/deletes rows.

    In that case it is definitely not possible to use a UDF - it is also not possible to call such a procedure for each row in a query.

    One suggestion is to modify the GetCalculatedBonus function so it actually calculates the correct bonus for each row in your source table.

    You would then call this procedure once and then you would use MERGE to merge the source with the destination.