How I can format string with D
in start and leading zeros for digits with length of less than four. E.g:
D1000
for1000
D0100
for100
I have tried to work with casting and stuff
function, but it didn't work as I expected.
SELECT STUFF('D0000', LEN(@OperatingEndProc) - 2, 4, CAST((CAST(SUBSTRING(@OperatingEndProc, 2, 4) AS INT) + 1) AS VARCHAR(10)));