You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by "rcolmegna@tiscali.it" <rc...@tiscali.it> on 2010/08/01 09:31:56 UTC
update auto-generated pk before insert
hi,
I need to determinate the value of an auto-generated PK before the
INSERT statement. I'm trying to use
this SQLs:
1) LOCK TABLE sys.
columns FOR EXCLUSIVE READ
2) SELECT referenceid,
autoincrementvalue+autoincrementinc FROM sys.syscolumns AS sc INNER
JOIN sys.systables AS st ON sc.referenceid=st.tableid WHERE
tablename='EMAIL2FOLDER' AND columnname='ID';
3) UPDATE sys.syscolumns
SET autoincrementvalue=autoincrementvalue+autoincrementinc WHERE
tableid='f91a0030-0129-e07e-88ec-0000016e72a0' AND idColumnName='ID';
4) use autoinc value, from step-4 select, in my INSERT on the
destination table
but I obtain an error due to the insufficient
permission of the connected user (derby is used in embedded mode)
for
the statement 1 and 3.
Is there any way to escale privileges or to
create a special permission user-function?
TIA
Risparmia con Tutto Incluso Light: telefono + adsl 8 mega a soli 19,95 € al mese per un anno!
SCONTO DI 120 EURO!
L’offerta è valida solo se attivi entro il 29/07/10
http://abbonati.tiscali.it/telefono-adsl/prodotti/tc/tuttoincluso_light/?WT.mc_id=01fw