Archives of the TeradataForum
Message Posted: Tue, 23 Sep 2003 @ 13:24:03 GMT
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
|Copyright 2016 - All Rights Reserved|
|Last Modified: 28 Jun 2020|