• I really have no idea what you are asking, since your procedure doesn't reference the tables you mention at all.

    Do you mean you want to set the amount variable? Or are you trying to update one or the other of the tables you mentioned with the value you calculate?

    In general, when posting a question, you'll get much better quality answers if you put in the time to create a script that sets up the problem, and give an example of the result you want to see based on the sample data that you provide.



    Dan Guzman - Not the MVP (7/22/2010)
    All questions have to be prefaced by Server version and 'according to MS Docs' or 'my own personal opinion based on how much detail I felt like digging into at the time.'