All Forums Database
17 Jul 2012
insert range of values in a table

I am new to teradata and not a big developer. Can anyone please suggest me how to insert range of values in a table. for Eg: i would like to insert data into the table between the range 1090 to 9000.

Qaisar Kiani 337 posts Joined 11/05
17 Jul 2012

You can try this SQL

SEL CSUM(1,1) + 1090 AS SEQ

This will give you the required sequence number, you can include this query in a subquery of INSERT-SELECT statement to populate the required table's field.


18 Jul 2012

thanks!! this is useful

dnoeth 4628 posts Joined 11/04
19 Jul 2012

Be careful, CSUM(1,1) is the same as ROW_NUMBER() OVER (ORDER BY 1).

And "ORDER BY 1" means order by the constant value 1, which results in skewed single AMP processing.

No problem for a small number of rows but bad for large data sets.

Better order by a more or less unique column. In your special case you could also use day_of_calendar instead of CSUM.



19 Jul 2012

that makes sense!! I am trying to deal with only hundreds of records.

You must sign in to leave a comment.