Very recently i wanted to migrate the data from 10M record table. This table didn't have clustered key and the business primary key was a GUID column. For obvious reasons the data needed to be transferred in chunks. The listed code provided the upper and lower boundaries. DECLARE @NumParts INT = 128; WITH PartsOf256(Part) AS ( SELECT (256 / @NumParts) UNION ALL SELECT Part + (256 / @NumParts) FROM PartsOf256 WHERE Part < (256 - 256 / @NumParts) ) SELECT CONVERT(UNIQUEIDENTIFIER, 0x00000000000000000000 + CONVERT(VARBINARY(1), Part)) FROM PartsOf256 option (maxrecursion 0)
This blog is to, share the encounters and learning’s of Sql Server