求整数的逆序数

DECLARE @INPUT BIGINT,@RESULT BIGINT
SET @INPUT=1234
SET @RESULT=0
while @INPUT>0
BEGIN
SET @RESULT=@RESULT*10+@INPUT%10
SET @INPUT=@INPUT/10
END
SELECT @RESULT

编程技巧