Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread How to remove a generator
Mon, Sep 9 2013 10:39 PMPermanent Link

Peter Evans

Subject : How to remove a generator

Still porting from DBISAM to ElevateDB.

I have a routine that appends one table to another table. I get the
error 'Field 'RecNum' cannot be modified'.

Interesting one table has its generator starting at 0, the other at 999.

I think the solution is to remove the generator from the target table. I
don't want any of the RecNum values to change.

This is how the field RecNum is created :-

  "RecNum" INTEGER GENERATED ALWAYS AS IDENTITY (START WITH 0,
INCREMENT BY 1)

(Previously in this forum I asked how to change the Generator, so I know
how to do that.)

I can't find anywhere how to remove the generator. I searched the forum.
I guess it will be like :-

  ALTER TABLE "Repos"
  ALTER COLUMN "RecNum" INTEGER

So will the above somehow remove the generator? Do I have to specify
something else?

Regards,
  Peter Evans
Tue, Sep 10 2013 4:14 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Peter


Teaching a man to fish:

One of the most useful bits of EDBManager is Explorer | SQL History

When you have  question like this carry out the operation in EDBManger and then look in Explorer | SQL History and you'll see what SQL was generated.

In this case your guess is quite correct

ALTER TABLE "Booking"
ALTER COLUMN "BookingID" AS INTEGER

alters the column back to a plain old integer


Roy Lambert [Team Elevate]
Tue, Sep 10 2013 6:28 PMPermanent Link

Peter Evans

On 10/09/2013 6:14 PM, Roy Lambert wrote:
> Peter
>
>
> Teaching a man to fish:

> In this case your guess is quite correct

Actually I made a mistake in syntax. Based on your code my example
should read :-

  ALTER TABLE "Repos"
  ALTER COLUMN "RecNum" AS INTEGER

What I do now is call the above routine before my routine to append one
table to another. It looks as though things are now working.

Regards,
  Peter Evans
Image