Reputation: 35
the below query gives me result as 90 AND NOT 90%.
SELECT
CAST(convert(decimal(20,10),[Total]) as int) AS 'TT'
,cast((convert(decimal(20,10),([Count_Checked_Out]/convert(decimal(20,10),[Total])))* 100) as int) AS '%_Checked_Out'
Upvotes: 0
Views: 75
Reputation: 1877
If you want to do this in sql query you can do something like this
select concat(90,"%") as percent_value;
But as @Joel Coehoom pointed out you should do this in your presentation layer
http://sqlfiddle.com/#!9/9eecb/191808/0
Upvotes: 0
Reputation: 416039
If you want formatting, of any kind, you must convert the value from a number type, like int
, to a string type, like nvarchar
. Exactly what this looks like depends on what specific database platform you're using.
But in most cases, you're better off leaving this work for your client code or reporting tool.
Upvotes: 2