I 'm using this code:
// example of my columns: 01
02
03
select max(panelname) + 1
I want my result have always two digits. Lets say that my value is >10 when adding +1 to take this result ex. from 01 to 02 when value is < 10 when adding +1 to take this result ex.from 23 to 24
You could do something like this:
SELECT CASE WHEN max(panelname) + 1 < 10 THEN '0' ELSE '' END + CONVERT(VARCHAR(2), max(panelname) + 1)