My code below now gives a result but with too many decimal places...Here's the output:
Is this the correct way to display as Percentage? And how do I reduce the number of 0s after the decimal?
DECLARE @StartingNum int
DECLARE @NumDifference numeric (38,6)
Declare @ResultsData as table
MyPoints varchar(80) null
insert into @ResultsData
CAST(((cast(NumDifference as numeric(38,2))/
cast(@StartingNum as numeric(5,2)))*100) AS VARCHAR(56) )+'%' AS MyPoints
best practice is to do formatting in the front end application
the query should return plain numbers, not formatted character strings
even calculations such as percentages should really be done in the front end
This topic is now archived. It is frozen and cannot be changed in any way.