NTILE
SELECT (ROW_NUMBER() OVER (ORDER BY Id)-1) / 10 + 1 AS GroupId ,[Id] , .... FROM TBL
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)