On 11-2-2012 18:05, Kjell Rilbe wrote: > Enter one row in this table for each table you need a PK "generator" > for. To aquire a key, start your transaction with: > > update "PK" > set "LastUsedId" = "LastUsedId" + 1 > where "TableName" = :TableName > > Then > > select "LastUsedId" > from "PK" > where "TableName" = :TableName
You could UPDATE .... RETURNING "LastUsedId" (or explicitly NEW."LastUsedId") to get it in one go. -- Mark Rotteveel ------------------------------------ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Visit http://www.firebirdsql.org and click the Resources item on the main (top) menu. Try Knowledgebase and FAQ links ! Also search the knowledgebases at http://www.ibphoenix.com ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/firebird-support/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/firebird-support/join (Yahoo! ID required) <*> To change settings via email: [email protected] [email protected] <*> To unsubscribe from this group, send an email to: [email protected] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
