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 |
|
suki_66
Starting Member
12 Posts |
Posted - 2010-03-29 : 15:31:40
|
| how would you write this formula in sqlThis is what i have@FinalAmount = (@P * (1 + dbo.[IntRate](@N))^@N)This is the errorMsg 402, Level 16, State 1, Procedure FinalAmount, Line 7The data types decimal and int are incompatible in the '^' operator.What I am trying to do is calculate the compound interest |
|
|
david.wendelken
Starting Member
2 Posts |
Posted - 2010-03-30 : 13:32:10
|
| What are the data types for the various variables in your formula?Don't understand what you are trying to do with this portion of the formula: dbo.[IntRate](@N) |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-03-30 : 13:42:59
|
| seems like return type of udf dbo.[IntRate] is decimal which causes this error------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
suki_66
Starting Member
12 Posts |
Posted - 2010-03-30 : 16:29:42
|
| I figured it out - the correct formula would be@FinalAmount=@P*POWER(@N,(1+dbo.Rate(@N)) |
 |
|
|
|
|
|