You can easily extract a set of columns without the primary key as follows:

    List<Field<?>> fields = new ArrayList<>(Arrays.asList(KTO.fields()));
    fields.removeAll(KTO.getPrimaryKey().getFields());

    create1.insertInto(KTO).columns(fields).select(
        select(fields).from(KTO)
    ).execute();

Hope this helps,
Lukas

On Thu, Mar 28, 2019 at 9:39 AM Christian Master <[email protected]> wrote:

> I try to copy the records from one database to another.
>
> create1.insertInto(Tables.KTO).select(
>                     create2.select().from(Tables.KTO)
>             ).execute();
>
> Since I have a primary key with auto_increment this wont work.
>
> In pure SQL it is not possible to exclude the primary key in create2.
> Is it possible with jooq?
> I don't want to write all the fields into a "insertInto" method.
>
> If it is not possible, is there a way to copy the values from SomeRecord a
> to SomeRecord b without doing it field by field?
>
> Thx
> Chris
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "jOOQ User Group" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "jOOQ 
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to