Diameter calculation

 DevX Home Today's Headlines   Articles Archive   Tip Bank   Forums

1. Tom Guest

## Diameter calculation

I am trying to calculate the diameter of a coil with a 27" open center using
density,weight and width. I have this in excel and it works ok.I would like
to use it in sql. Problem is I keep getting missing parenthesis error.
Here is my calculation from excel

=SQRT((WT/Den/Width+(PI()*(27/2)^2))/PI())*2

density (DEN) of the material is .098 constant width and weight vary.
Any help would be of great assistance

2. Simon Sellick Guest

## Re: Diameter calculation

"Tom" <tvertrees@yahoo.com> wrote:
>
>I am trying to calculate the diameter of a coil with a 27" open center using
>density,weight and width. I have this in excel and it works ok.I would like
>to use it in sql. Problem is I keep getting missing parenthesis error.
>Here is my calculation from excel
>
>=SQRT((WT/Den/Width+(PI()*(27/2)^2))/PI())*2
>
>density (DEN) of the material is .098 constant width and weight vary.
>Any help would be of great assistance

Tom,
What's PI()? It looks like a function call - does it exist in your target
environment? I take it the other variables are defined and have values.

Is your intended formula (in steps, showing each partial result pn):

1) p1 = Density / Width
2) p2 = WT / p1
3) p3 = p2 + area of open centre (See note 1)
4) p4 = p3 / pi
5) p5 = square root p5 (note 2)
6) p6 = p5 squared

...or have I misunderstood it?

Notes
1) 27/2 = 13 in some DBMSs - use 27.0)
2) That's the way it reads, but presumably you want to square it first then
take the root to avoid negatives?

Hope this helps,
Simon

3. Bill Slater Guest

## Re: Diameter calculation

Simon Sellick wrote:

> "Tom" <tvertrees@yahoo.com> wrote:
> >
> >I am trying to calculate the diameter of a coil with a 27" open center using
> >density,weight and width. I have this in excel and it works ok.I would like
> >to use it in sql. Problem is I keep getting missing parenthesis error.
> >Here is my calculation from excel
> >
> >=SQRT((WT/Den/Width+(PI()*(27/2)^2))/PI())*2
> >
> >density (DEN) of the material is .098 constant width and weight vary.
> >Any help would be of great assistance

>
> Tom,
> What's PI()? It looks like a function call - does it exist in your target
> environment? I take it the other variables are defined and have values.
>

"PI()" is 3.1415926... an irrational number that Excel has a built-in function to
produce. There is no SQL Server analog as it is a mathematical value and is a
number that never terminates and never repeats. Code it as a constant to whatever
resolution is appropriate for the application.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•

 FAQ Latest Articles Java .NET XML Database Enterprise