Paradox AutoInc Field - Issue

Paradox AutoInc Field - Issue

Post by Andy Hil » Thu, 16 Nov 2000 06:48:40



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

 
 
 

Paradox AutoInc Field - Issue

Post by Markku Nevalaine » Thu, 16 Nov 2000 07:58:01



> 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

 
 
 

Paradox AutoInc Field - Issue

Post by Jovan Sedla » Sun, 31 Dec 1899 09:00:00


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

http://www.sedlan.com
#7 Components Home


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

 
 
 

1. Paradox autoinc fields vs MS SQL identity fields

There seem to be an anoying bug somewhere between Delphi3 and MS SQL
server:

Paradox tables can have an autoincrement field as primary key, and that
fields definition
don't need to include the "Required" property (set to true), while MS
SQL 6.5
tables' identiy fields (similar tp pdx autoinc field), must be set
"Required" (i eg "NOT NULL").
Inserting records in a MS SQL table with Database Explorer gives the
following frustrating problem:
If i don't supply a value for the identiyfield (which should be done by
the server, not me),
then the BDE refuses to post the record because "Field <identiyfield>
must have a value!".
On the other hand, IF a supply a value for the identiyfield, then the
BDE happily posts the record, and instead MS SQL protests, saying
"Trying to explictly insert value for identiyfield".

So my question is, is MS SQL 6.5 Identiyfields usable with Delphi or do
they just
cause more trouble than using Triggers simulating autoinc fields?

Regards, Ola Br?hammar

2. Provider=Microsoft.Jet.OLEDB.4.0 vs 3.51

3. Autoinc paradox fields - programmatic creation - HELP

4. Database Startup Script for Netware 4.1

5. AutoInc field in Paradox tables

6. pgsql-server/src/bin/initdb Tag: REL7_3_STABLE ...

7. Paradox autoinc fields-Problem-HELP!!!!

8. Column objects and .Visible don't jive

9. AutoInc Field / Paradox 5 Rebuild

10. AutoInc field creating Paradox table programatically

11. Using a AutoInc field with Paradox table.

12. link master autoInc field to Detail Integer field

13. Paradox Autoinc as keys