Please start any new threads on our new site at http://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | 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
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

arkiboys
Flowing Fount of Yak Knowledge

1433 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
22864 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

1433 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
8781 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

1433 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  
 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.05 seconds. Powered By: Snitz Forums 2000