1 of 5

JavaScript (ES6) 74

A first try, not so golfed

S=n=>(
  l=(n+'').length,
  n<'1'.repeat(l)&&--l,
  (n-~'8'.repeat(l)+'').slice(1)
)

Test in FireFox console

;[0,1,10,11,42,100,800,1060,10270,100501]
.forEach(x => console.log(x +" -> '" + S(x) + "'"))

Output

0 -> ''
1 -> '0'
10 -> '9'
11 -> '00'
42 -> '31'
100 -> '89'
800 -> '689'
1060 -> '949'
10270 -> '9159'
100501 -> '89390'