SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 power
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

arkiboys
Flowing Fount of Yak Knowledge

1418 Posts

Posted - 10/16/2012 :  10:33:38  Show Profile  Reply with Quote
Hi,
This is an excel formula:
=IF(1276<300, "NA",((34.45/100+1)^(300/1276)-1)*100)
How can I translate it to sql with power function please?

My main issue is that I can not get the power in sql to basically give the same answer as

((34.45/100+1)^(300/1276)-1)*100
The answer should be 7.21
Thanks

Edited by - arkiboys on 10/16/2012 10:37:13

madhivanan
Premature Yak Congratulator

India
22765 Posts

Posted - 10/16/2012 :  10:44:45  Show Profile  Send madhivanan a Yahoo! Message  Reply with Quote
Use power function


select power(34.45/100+1,(300/1276)-1)*100



Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

arkiboys
Flowing Fount of Yak Knowledge

1418 Posts

Posted - 10/16/2012 :  10:47:57  Show Profile  Reply with Quote
quote:
Originally posted by madhivanan

Use power function


select power(34.45/100+1,(300/1276)-1)*100



Madhivanan

Failing to plan is Planning to fail


This gives 7.21
=((34.45/100+1)^(300/1276)-1)*100

Your sql does not give this answer.
Go to Top of Page

sunitabeck
Flowing Fount of Yak Knowledge

5155 Posts

Posted - 10/16/2012 :  11:08:37  Show Profile  Reply with Quote
Rearrange the brackets a little bit:
(POWER((34.45/100+1),(300.0/1276))-1)*100
Go to Top of Page

webfred
Flowing Fount of Yak Knowledge

Germany
8765 Posts

Posted - 10/16/2012 :  11:11:30  Show Profile  Visit webfred's Homepage  Reply with Quote
to get 7.21:
select convert(decimal(12,2),(power((34.45/100.00+1.00),(300.00/1276.00))-1.00)*100.00)


Too old to Rock'n'Roll too young to die.
Go to Top of Page

arkiboys
Flowing Fount of Yak Knowledge

1418 Posts

Posted - 10/16/2012 :  11:28:56  Show Profile  Reply with Quote
Thank you
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000