Autogenerate insert value like excel

MOHD SHAH BANI MOHD ZAHIR 21 Reputation points
2021-07-18T14:01:23.88+00:00

115642-image.png

Hi,

I have 8 group name to insert to 1000 row repeatably. How to do it in Data Services to generate automatically the 5 username insert to 1000 row ?

thanks.

SQL Server | Other
0 comments No comments
{count} votes

Answer accepted by question author
  1. Erland Sommarskog 129.6K Reputation points MVP Volunteer Moderator
    2021-07-18T15:41:20.953+00:00

    Not sure what you mean with Data Services, but there are so many products in the Data Platform sphere, I can't keep track of them all.

    In plain SQL query you can do:

    SELECT BIL, POSKOD, STATUS, KETERANGAN, LOKASI, 
            row_number() OVER(ORDER BY BIL) / % 8 + 1
    FROM  tbl
    

    The row_number function numbers the rows ordered by what you specify in the ORDER BY clause. % is the modulus operator.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.