Quantcast
Channel: Teradata Forums - All forums
Viewing all articles
Browse latest Browse all 27759

Unique gapless ID:s from system - how to? - response (1) by dnoeth

$
0
0

The only way to get a gapless sequence is to do it on your own with ROW_NUMBER like

select 
   row_number() over (order by whatever) 
   + coalesce((select min(seq) from tab), 0) as seq
....
from tab 

Instead of "select min(seq) from tab" you might have an extra table storing with the current max value for this table and then you increase it by the activity_count (probably using a SP).
 
Dieter


Viewing all articles
Browse latest Browse all 27759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>