Advertisement
Guest User

Untitled

a guest
Sep 28th, 2016
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. /*Write a stored procedure named “spAddPercentage” that adds a percentage (passed as a
  2. parameter named “In
  3. cPercent”) to the value of an order if the value of IncPercent is under
  4. 10%, or if IncPercent is 10% or over, add 10% to the value of an order for all orders in the
  5. OrderDetails table utilising IF/ELSE.*/
  6.  
  7.  
  8. Use SKILLAGEITDB
  9. go
  10. Create procedure [spAddPercentage]
  11. as
  12. declare @incPercent decimal(1,0)
  13. if @incpercent < 0.1
  14.  
  15.  
  16. update OrderDetails
  17. set value = value * 1.10
  18. begin
  19.  
  20.  
  21. if @incpercent = 0.1
  22. update OrderDetails
  23.  
  24. set value = value * (1 + @incpercent)
  25. else
  26.  
  27.  
  28. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement