Removing excess zeros

Hi SQL Gurus! :slight_smile:

Hoping someone can help me with what i hope is an easy question?

I have the below aggregate, but i can't figure out how to get it to only show 2 decimal places! ive tried, cast, convert and format - but evertime i do is just returns a 0???

round(b.[TrackStreams] * 100.0 / sum(b.[TrackStreams] * 100) OVER (PARTITION BY b.[ChartDate]),2) AS 'Market Share'

which returns...
0.020000000000000

But i want it to just show..

0.02

Please help! :slight_smile:
thank you

hi

i tried to do this !!!!
hope this helps :slight_smile: :slight_smile:

DECLARE @num DECIMAL(10, 9) = 0.020000000000000 

SELECT 'number decimal(10,2)', 
       @num 

SELECT 'cast number as float ', 
       Cast (@num AS FLOAT)

image

Hi harishgg1

That worked!! so simple :smiley:

Thank you very much