Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DECLARE @max_id INT = (SELECT MAX(ID) FROM your_table),
- @checpoint INT = 500000,
- @current_id INT = 0,
- @step INT = 0;
- WHILE (@current_id < @max_id)
- BEGIN
- INSERT INTO #tmp
- SELECT *
- FROM your_table
- WHERE id > @current_id and id < @current_id + @step * @checkpoint;
- -- your analysis here
- SET @step += 1;
- SET @current_id = @current_id + @step * @checkpoint
- END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement