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 |
|
apantig
Posting Yak Master
104 Posts |
Posted - 2005-11-18 : 21:34:54
|
| Hi guys,How to use exponent in stored procedure?Say, I need to get the exponent of123 ^ 5I used the ^ symbol but it gives me an error message withXOR. I also used the EXP() but it gives me diffent value.Please help |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2005-11-18 : 21:37:59
|
| SQL Server uses the POWER() function:SELECT POWER(123, 5) |
 |
|
|
apantig
Posting Yak Master
104 Posts |
Posted - 2005-11-18 : 21:43:45
|
| Thank you. It works now. |
 |
|
|
apantig
Posting Yak Master
104 Posts |
Posted - 2005-11-20 : 21:58:00
|
Guys,I dont think Power() would help me in my problem.I need to get the Present Value Factor or PVFactor column in my table. The formula is PVFactor=1 / (1 + (.10 / 12)) ^ n. Where n is an increment value starting 1 upto 50.To get the NPV or the Net Present Value, I need to use this formula:NPV=Amount * PVFactorSample DataAmount Increment 29591.39 1369892.40 2 29591.39 3 29591.39 4 29591.39 5...and so on... My question is, how to apply the EXP() or the Power() in PVFactor? |
 |
|
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts |
Posted - 2005-11-20 : 22:43:40
|
I believe this is the correct formula for the Present Value Factor calculation:declare @rate numeric(10,8)declare @periods numeric(10,5)-- Interest rate per periodselect @rate = 0.005-- Number of periodsselect @periods = 360select [PV factor] = (1.000/@rate) - ((1.000/@rate) * power(1.000/(1.0000+@rate),@periods))PV factor ---------------------------------------- 166.791614(1 row(s) affected) Formula from:http://financialrounds.blogspot.com/2005/07/math-behind-loans.htmlPV factor = 1/r – (1/r) x [1/(1+r)] ^ n = (1/0.005) – (1/0.005) x (1/1.005)^360= 166.7916CODO ERGO SUM |
 |
|
|
|
|
|