select prodid, remaininventphysical,
len(replace( rtrim( replace(
convert( varchar, remaininventphysical), '0', ' ' ) ), ' ', '0' ) ) -
charindex( '.', replace( rtrim( replace(
convert( varchar, remaininventphysical ), '0', ' ' ) ), ' ', '0' ) )
as nonzerodecimalplacesused
from PRODBOM
order by prodid;
Output:
prodid remaininventphysical nonzerodecimalplacesused
-------------------- --------------------------------------- ------------------------
24-015377 0.0600060006000600 14
24-015376 0.0800000000000000 2
24-014563 0.0450045004500450 15
24-013446 0.0450045004500450 15
24-013445 0.0000000000000000 0
24-011934 0.0000000000000000 0
24-008828 0.0000000000000000 0
24-008602 0.0000000000000000 0
24-006598 0.0000000000000000 0
23-039521 0.0000000000000000 0
No comments:
Post a Comment