Board index » delphi » Paradox AutoInc Field - Issue

Paradox AutoInc Field - Issue

Hi.

I have a need to copy data from one table (original) to another table (new -
made on the fly) for the purpose of version updating where I can carry out a
row by row analysis within a while loop (this gives me the opportunity to
test the original data field by field and modify if necessary to suit the
new tables structure and application version logic) thereby inserting the
correct data into the new table. This has been my practice for many years
but recently I have come up against an ftAutoInc issue, in the past I
refused to use AutoInc Fields but find myself working on a project where
this was not the case.

My problem is that the new tables AutoInc Field value must be the same as
the original, as you know the BDE adds the new AutoInc value on insert
refusing to let me edit it and this value will not always be the same value
as the original tables AutoInc Field for obvious reasons.

How do I Edit this value or pre-prime the BDE with the value I want it to
use before it is inserted ?

--
Regards
Andrew Hill

 

Re:Paradox AutoInc Field - Issue


Quote
Andy Hill wrote:
> How do I Edit this value or pre-prime the BDE with the value I want it to
> use before it is inserted ?

Add the new field first as LongInt field, and fill in the values you
read from the old AutoInc field. After this, turn the new LongInt
field to AutoInc.

You can do these translations with Database Desktop, and maybe with
DatabaseExplorer also, and of course from inside your code. LongInt
fields can be turned to AutoInc, but not vice versa.

I don't know if there are any easier ways to handle AutoInc contents.

Markku Nevalainen

Re:Paradox AutoInc Field - Issue


It's pretty simple - in the original table, change the AutoInc field(s) to
Long Integer. Then copy your data to a new table, and revert Long Integer
field(s) in both tables to AutoInc. Or, (I haven't tried this, but it seems
easier) do the change just for the new table. For changing the field types
look at the DbiDoRestructure (there are also examples on its use on
Borland's site).

P.S. If you need a quick solution, check out the TRestructure component on
http://www.sedlan.com

--
Jovan Sedlan
i...@sedlan.com
http://www.sedlan.com
#7 Components Home

Quote
"Andy Hill" <andyh...@hawknet.com.au> wrote in message

news:3a11c173.0@203.33.112.20...
Quote
> Hi.

> I have a need to copy data from one table (original) to another table
(new -
> made on the fly) for the purpose of version updating where I can carry out
a
> row by row analysis within a while loop (this gives me the opportunity to
> test the original data field by field and modify if necessary to suit the
> new tables structure and application version logic) thereby inserting the
> correct data into the new table. This has been my practice for many years
> but recently I have come up against an ftAutoInc issue, in the past I
> refused to use AutoInc Fields but find myself working on a project where
> this was not the case.

> My problem is that the new tables AutoInc Field value must be the same as
> the original, as you know the BDE adds the new AutoInc value on insert
> refusing to let me edit it and this value will not always be the same
value
> as the original tables AutoInc Field for obvious reasons.

> How do I Edit this value or pre-prime the BDE with the value I want it to
> use before it is inserted ?

> --
> Regards
> Andrew Hill

Other Threads