views:

190

answers:

1

How do you calculate Average Percentage Yield (APY) with T-SQL? Is there a system function to calculate APY or do I have to create one?

Note: APY = (1 + r/n )^n – 1 where r is the stated annual interest rate and n is the number of times you’ll compound per year.

+2  A: 

You could write your own function, but you can also do it directly in T-SQL like this:

declare @r float, @n int
select @r=.1, @n=12
select power((1+(@r/@n)), @n)-1;
Quesi