T-SQL,394字节(无奖励)
我想'为什么不 ',对吗?
DECLARE @i INT, @k INT SET @i = 100 SET @k = 200 WITH g AS (SELECT @i AS n UNION ALL SELECT n+1 FROM g WHERE n+1<=@k ) SELECT LEN(n) AS c FROM (SELECT STUFF((SELECT REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(n, 1, ''), 2, ''), 3, ''), 4, ''), 5, ''), 6, ''), 7, ''), 8, ''), 9, ''), ' ', '') FROM g FOR XML PATH ('')) ,1,0,'') n ) a OPTION (maxrecursion 0)
和友好的:
-- CG!
DECLARE @i INT, @k INT
SET @i = 100
SET @k = 200
WITH g AS
(
SELECT @i AS n
UNION ALL
SELECT n+1 FROM g WHERE n+1<=@k
)
SELECT LEN(n) AS c FROM
(
SELECT
STUFF((SELECT REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(n, 1, ''), 2, ''), 3, ''), 4, ''), 5, ''), 6, ''), 7, ''), 8, ''), 9, ''), ' ', '')
FROM g FOR XML PATH ('')) ,1,0,'') n
) a
OPTION (maxrecursion 0)