This SQL script shows free space in sequences in percent.
select a.* from ( select a.*, cast( cast( a.[free] as numeric(15,2) ) / cast( a.[space] as numeric(15,2) ) * 100 as numeric(15,2) ) as [free_%] from ( select a.numbersequence, a.lowest, a.highest, a.nextrec, a.highest - a.lowest as [space], a.highest - a.nextrec as [free] from numbersequencetable a where a.blocked = 0 and a.cyclic = 0 ) a ) a order by a.[free_%]Output:
numbersequence lowest highest nextrec space free free_%
-------------- ----------- ----------- ----------- ----------- ----------- --------
Inve_38 1 999999 703701 999998 296298 29.63
Inve_33 1 99999 31366 99998 68633 68.63
Gene_24 1 99999 29841 99998 70158 70.16
Time_6 1 9999999 2665830 9999998 7334169 73.34
Docu_3 1 99999 19037 99998 80962 80.96
Prod_26 1 9999999 1327561 9999998 8672438 86.72
Prod_27 14000 999999 130299 985999 869700 88.20
No comments:
Post a Comment