This is my SP:
SELECT
CAST(id AS varchar(10)) + ' - ' + UserName AS 'User List',
Scanned,
Scripts AS 'Total Scripts',
Processed,
CAST((Processed/ Scripts)* 100.0 as int) AS 'DONE (%)'
FROM tblworkQueue
Processed and Scripts are both DataTypes of int
My DONE(%) column comes back with 0
Any idea where I am going wrong?
It is could be also if both your fields you use for dividing you useCAST((Processed/ Scripts)* 100.0 as int) processed and Scripts are integer values and I assume that processed is smaller so when you divide integers result is also integer so you get something below 1 and it is rounded to 0. try to use
CAST((100.00 *Processed/ Scripts) as int)
maybe it will work better?
No comments:
Post a Comment