• You can use a Modulo operator to remove the hard coding of values

    DELETEtemp

    FROM(

    SELECTROW_NUMBER() OVER(PARTITION BY x.cStudentId,x.dtEnrollmentDate ORDER BY dtEnrollmentDate asc ) AS DSeq, x.*

    FROM#temp1 x

    ) temp

    WHERE ( DSeq % 5 ) > 0


    Kingston Dhasian

    How to post data/code on a forum to get the best help - Jeff Moden
    http://www.sqlservercentral.com/articles/Best+Practices/61537/