June 23, 2009 at 9:27 am
Hello Folks,
I hope you can help me with a formula problem.
I have an excel function
=P+1/N+2*SQRT((P*(1-N)/B)+1/(2*N^2))/(1+2/N)
where P= 0.448275862
and N = 29.0
It gives the result 0.661462636
I have tried to emulate that function in a SQL Function
alter function upper95(@p float, @n float)
returns float
as
begin
return (@P+1/@n+2*SQRT((@P*(1-@P)/@n)+1/(2* POWER(@n,2)))
)/(1+2/@n)
end
go
again
P= 0.448275862
and N = 29.0
It is giving the result
0.630316918360941
Can anyone see what the problem is with my SQL Function here?
Thanks
Mick
June 23, 2009 at 9:51 am
Too many parens in your SQL version. Try this:
alter function dbo.upper95(@P float, @N float)
returns float
as
begin
return @P+1/@N+2*SQRT((@P*(1-@P)/@N)+1/(2* POWER(@N,2)))/(1+2/@N)
end
go
June 23, 2009 at 10:46 am
Thanks Lynn,
You saved me there 🙂
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply