Split rows into equal number of records per group in sql server

 In SQL server by using function NTILE we can split the equal number of records from a table to number of groups

SELECT *,NTILE(5) over( ORDER by Id) GroupNo
from Table


Here records will be assigned to 5 groups (Group No: 1,2,3,4,5).

Comments

Popular posts from this blog

List of special Characters in HTML

How to Read TOC Headings from word document using C#