Results 1 to 2 of 2

Thread: Using Round and Cast

  1. #1
    Join Date
    Mar 2009
    Posts
    32

    Question Using Round and Cast

    I am trying to cast an integer(bp.gross_quantity) to decimal and divide quantity by 42 (from gallon to barrels) and round to nearest hundreds.


    Code:
    Select round(cast((bp.gross_quantity as dec(15.3))/ 42), 3) as gross_qty,
    Getting syntax error.

  2. #2
    Join Date
    Mar 2009
    Posts
    32

    Smile

    Found the answer:

    Code:
    round((cast(bp.gross_quantity as decimal(15, 4)) / 42), 3) as gross_qty,
    Thank you.

Posting Permissions

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