First I am converting the value from the table as integer like
cast(convert(int, isnull(b.temp,0)) as varchar(500))
and then I would like to output values as written below for example
1 as 001
12 as 012
123 as 123
-1 as -001
-15 as -015
-234 as -234
and if length of the integer value is more than 3 then do not display any value or remove it. If integer has Minus(-) sign then it is not part of the length so -001 is consider as length 3
so 001 and -001 is acceptable as length 3
How can I do that?