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
 General SQL Server Forums
 New to SQL Server Programming
 How to add 7% for the total and calculate VAT

Author  Topic 

Vaishu
Posting Yak Master

178 Posts

Posted - 2007-08-22 : 05:03:55
Hi

I am using the below code in sql procedure.How do I add 7% of the price and then VAT for the total.

CAST(CAST(cast(Price * 1.175 as decimal(19, 2)) as INT) + 0.99 AS DECIMAL(19, 2)) as [item-price],'

Advance thanks

AndrewMurphy
Master Smack Fu Yak Hacker

2916 Posts

Posted - 2007-08-22 : 05:24:36
usually useful to supply sample input data with sample expeted results..

however...does this suit?

select price, price * 1.07, price * 1.175, price * 1.07 * 1.175 from mytable -- assuming VAT is 17.5%

The casts look wrong/unnecessary as they will round/truncate answers.
Go to Top of Page

Vaishu
Posting Yak Master

178 Posts

Posted - 2007-08-22 : 06:44:18
Hi

It works Thanks a lot
Go to Top of Page
   

- Advertisement -