Generating range of numbers 1…n in SAP HANA


You can use For loop as below:

FOR START_CID IN 1..1000 DO
   INSERT INTO "TEST_TABLE" VALUES(START_CID,'');
END FOR;

You can also use a Generator like this:

INSERT INTO "TEST_TABLE" SELECT GENERATED_PERIOD_START as CID, '' as CNAME from SERIES_GENERATE_INTEGER(1,1,1001);

Ali
Ali

Updated on: 18-Dec-2019

276 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements