Home Page for the TeradataForum

Archives of the TeradataForum

Message Posted: Tue, 23 Sep 2003 @ 13:24:03 GMT

  <Prev Next>  

Subj:   Sequence/Identity cont. System Generated Keys
From:   Little, Doug


Many thanks to the people who offered suggestions for generating surrogate keys in a v2r4 install.

I tried using a triggered stored proc but this didn't work because of internal constraint where you can't update the table being inserted.

Instead I got this to work from Tpump

INSERT INTO table(Syskey,..,..) SELECT tgt.dt.nkey+Csum(1,1), :col1,:col2,:col3) FROM (select zeroifnull(max(syskey)) from Table) as TGT_DT(NKEY)


This uses the derived table feature to retrieve the starting key - I hope only once. The CSUM value keeps track of the inserted rows.

I tried the same with the coalesce function and couldn't get that to work due to a syntax error

Would anyone expect this when run several times to crash the Dbms? Unfortunately it happened, but support is unable to definitly tell me if this was the problem.

Thanks again for the help

Doug Little
Data Architecture Services
E1E007D - Itek Building
Ford Motor Co

  <Prev Next>  
  Top Home Privacy Feedback  
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 28 Jun 2020