DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 3 of 3
  1. #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. #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. #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.





Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links