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.
| Author |
Topic |
|
Pace
Constraint Violating Yak Guru
264 Posts |
Posted - 2009-01-12 : 11:20:56
|
Hi Experts, I have a field which I wish to increase by 15% and 15% again. So if we have 100, I want to end up with 100 + 15% + 15% = 132.25.How can I do this in tsql? I can get 15% obviously but not the subsequent percentage.Any help would be really appreciated, Barry"Impossible is Nothing"  |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-01-12 : 11:25:33
|
| UPDATE tableSET field= field *(115.0/100.0)*(115.0/100.0) |
 |
|
|
Skorch
Constraint Violating Yak Guru
300 Posts |
Posted - 2009-01-12 : 12:33:17
|
| DECLARE @percent INT, @value INTSET @percent = 15.0SET @value = 100.0SELECT @value * POWER((@percent+100.0)/100,2)So for your case you could do:UPDATE YourFieldSET YourField = YourField * POWER((15.0+100.0)/100,2) |
 |
|
|
|
|
|