Skip to content

Instantly share code, notes, and snippets.

@vibs2006
Last active March 17, 2023 15:27
Show Gist options
  • Save vibs2006/4abe47d88aae40a5a6e229ae1a0c6978 to your computer and use it in GitHub Desktop.
Save vibs2006/4abe47d88aae40a5a6e229ae1a0c6978 to your computer and use it in GitHub Desktop.
Vat CalculationSQL
declare @netprice decimal(18,2) = 120;
declare @vatrate decimal(18,2) = 20;
DECLARE @baseprice decimal(18,2)
SET @baseprice = @netprice / (1 + (@vatrate/100))
select @baseprice as BasePrice, ((@vatrate/100)*(@baseprice)) as Vat , @baseprice + ((@vatrate/100)*(@baseprice)) as NetPrice
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment