Skip to content

Instantly share code, notes, and snippets.

@PartTimeLegend
Last active October 14, 2016 05:45
Show Gist options
  • Save PartTimeLegend/f0e7e79023f4f44628e89c007de6dc47 to your computer and use it in GitHub Desktop.
Save PartTimeLegend/f0e7e79023f4f44628e89c007de6dc47 to your computer and use it in GitHub Desktop.
DECLARE @BatchSize INT
SET @BatchSize = 100000
WHILE @BatchSize <> 0BEGIN
DELETE TOP (@BatchSize) t
FROM [MyTable] t
INNER JOIN [Ids] d ON d.ID=t.ID
WHERE ????
SET @BatchSize = @@rowcount
END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment