Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 help with calculations in SP

Author  Topic 

hueby
Posting Yak Master

127 Posts

Posted - 2004-10-26 : 13:37:23
Hello everyone, if anyone could give me some guidance or provide examples I would greatly appreciate it!!!

I am converting a query from Access over to a SQL SP, for use with Crystal Reports. In the query there is a field/expression named taxprice.
It's formula is (1+[tax])*(price) and then I have a total (1+[markup]*([taxprice])*(quantity))

How can I go about using these formulas in my Stored Procedure? Also, would i use a CASE statement to have these formulas run if there was a certain value in my 'taxable (yes/no)' table?

Thank you all!

nr
SQLTeam MVY

12543 Posts

Posted - 2004-10-26 : 14:29:26
case when taxable = yes then (1+[markup]*((1+[tax])*(price))*(quantity) else 0 end

To use taxprice you would either need to use a function or a derived table.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

hueby
Posting Yak Master

127 Posts

Posted - 2004-10-26 : 15:01:36
Thank you for the information! I'll look into a function
Go to Top of Page
   

- Advertisement -