Find the smallest number bigger than the input whose digital sum is the input

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

DECLARE @ INT = 32

DECLARE @2 char(99)WHILE @>0SELECT
@2=concat(x,@2),@-=x FROM(SELECT IIF(@>9,9,IIF(@2>'',@,@-1))x)y PRINT @2

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results