1. Forum Rules (PLEASE CLICK HERE TO READ BEFORE POSTING) Click the link to access ADSM.ORG Acceptable Use Policy and forum rules which should be observed when using this website. Violators may be banned from this website. This message will disappear after you have made at least 12 posts. Thank you for your cooperation.

SQL "cast" rounding for tsm v 5 vs v6

Discussion in 'Scripting' started by sra006, Oct 26, 2012.

  1. sra006

    sra006 New Member

    Apr 21, 2005
    Likes Received:
    Hello ,
    I am running the following script to get the nodes throughput within a time interval

    SELECT cast(a.entity AS varchar(9)) AS "Node name", -
    CAST(sum(a.bytes/1024/1024) AS decimal(8,2)) AS "MB Xfer ", -
    CAST(sum(a.bytes/1024/1024/1024) AS decimal(8,2)) AS "GB Xfer " -
    FROM summary a, nodes b WHERE a.entity=b.node_name and a.activity='BACKUP' AND -
    a.start_time> current_timestamp - $1 hours GROUP BY a.entity

    Somehow when I run this on tsm v6 the results are rounded up and there are zeros after the decimal point
    Node name MB Xfer GB Xfer
    ---------- ----------- -----------
    AUSORAFIN 50160.00 47.00
    CHR7Z035 2365.00 2.00
    CHR7Z036 1332.00 1.00

    While similar report on the V5 does produce the fractions
    Node name MB Xfer GB Xfer
    --------- ---------- ----------
    USCP3005 917.69 0.89
    USCP3006 883.84 0.86
    USUS3001 1411.19 1.37

    Is there a way to get the fraction work in V6?

    Thank you ,
  3. CoMaboy

    CoMaboy Member

    Jun 4, 2012
    Likes Received:
    SELECT cast(entity AS varchar(9)) AS "Node name", -
    CAST(DEC(sum(bytes))/1024/1024 AS decimal(8,2)) AS "MB Xfer ", -
    CAST(DEC(sum(bytes))/1024/1024/1024 AS decimal(8,2)) AS "GB Xfer " -
    FROM summary WHERE activity='BACKUP' AND -
    start_time> current_timestamp - $1 hours GROUP BY entity

Share This Page