Subject AW: [firebird-support] How to handle this without a temp table...
Author Steffen Heil
Hi

> Create Table MyTable1
> (
> bigint id1 not null, // this uses a generator for auto assignment
> // other stuff here
> )
>
> Create Table MyTable2
> (
> bigint id2 not null, // this uses a generator for auto assignment
> // other stuff here
> )
>
> Create Table MyJoin
> (
> bigint joinid not null, // PK
> bigint id1 not null, // FK
> bigint id2 not null, // FK
> // other stuff here
> )

Create Table MyTempReplacement
(
bigint tempid not null,
bigint id1 not null
)

> What would be the 'recommended' way of doing this? Surely
> this is not a unique problem, so someone else's success story
> would be helpful!

Get a new tempid from a generator.
Insert all you id1's into the table with the tempid.
Do your join with ... where tempid = ?.
Delete from MyTempReplacement where tempid = ?.

Regards,
Steffen


[Non-text portions of this message have been removed]