5> DECLARE @sql AS VARCHAR(MAX), @i AS INT; 6> SET @sql = ''; 7> SET @i = 1; 8> WHILE @i <= 10 9> BEGIN 10> SET @sql = @sql + 'PRINT ' + CAST(@i AS VARCHAR(10)) 11> + CHAR(13) + CHAR(10); 12> SET @i=@i+1; 13> END 14> EXEC(@sql); 15> GO 1 2 3 4 5 6 7 8 9 10 1>