![]() |
|
Archives of the TeradataForumMessage Posted: Fri, 20 Feb 2004 @ 18:10:13 GMT
Hi , I have a table with Identity column. after and insert my goal is to get the primary key ( which is the identity colunm). To solve this problem did the following.
SELECT dbc.idcol.availvalue FROM dbc.idcol,dbc.tvm,dbc.dbase
WHERE dbc.idcol.tableid = dbc.tvm.tvmid and
dbc.idcol.databaseid = dbc.dbase.databaseid and
dbc.dbase.databasenamei = 'dbname' and
dbc.tvm.tvmnamei = 'processlog';
This Query is taking hell lot of time on our system any idea why? Is there any other way to accomplish this. Thanks Regards Vijay
logon_file=${1}
processid=${2}
processlogidfile=${4}
bteq << EOT
.run file=${logon_file};
.os del ${processlogidfile};
Database dbname;
BEGIN TRANSACTION;
LOCK TABLE processlog FOR WRITE
.export data file=${processlogidfile}
SELECT dbc.idcol.availvalue FROM dbc.idcol,dbc.tvm,dbc.dbase
WHERE dbc.idcol.tableid = dbc.tvm.tvmid and
dbc.idcol.databaseid = dbc.dbase.databaseid and
dbc.dbase.databasenamei = 'dbname' and
dbc.tvm.tvmnamei = 'processlog';
.export reset;
INSERT INTO PROCESSLOG (ProcessID,StartTime)
VALUES(${processid},CURRENT_TIMESTAMP);
END TRANSACTION;
.logoff
.quit
EOT
| ||||||||||||||||||||||||||||||||||||||||||||||||
| | ||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||
|
| ||||||||||||||||||||||||||||||||||||||||||||||||
| Copyright 2016 - All Rights Reserved | ||||||||||||||||||||||||||||||||||||||||||||||||
| Last Modified: 15 Jun 2023 | ||||||||||||||||||||||||||||||||||||||||||||||||