1

I wish to simply create a table of 100 rows in Aster where each row is a sequential integer. Easily as 1 - 100.

Am trying to do this in Aster/Teradata.

Once I complete it I am going to experiment with random functions.

Zach
  • 37
  • 8

2 Answers2

2

You can use a recursive CTE, or just basically fake it with row_number. Just find a (preferably small) table with at least 100 rows.

select distinct 
row_number() over (partition by <some column> order by <some column>
from
<your table>
 qualify row_number() over (partition by <some column> order by <some column> <= 100

Or you could use a spreadsheet to build 100 insert statements.

Andrew
  • 8,445
  • 3
  • 28
  • 46
1

You could just add 100 empty rows into a table with an auto-incrementing primary key starting at 0. I'm not familiar with Aster or Teradata, but with any macro language you it would look something like this:

for i = 0; i < 100; i++
    table.insert(new row())
next
Eric
  • 1,392
  • 17
  • 37
  • Thank you Eric - may I ask for the SQL code of table creation that will use that macro? I have never done a macro in Teradata before. – Zach Jan 30 '19 at 16:56