Board index » delphi » Copying database tables to new tables (haviing new fields)

Copying database tables to new tables (haviing new fields)

Hi

Can anyone tell me if there is a tool/utility which will allow me to copy
my existing database tables to new tables which have additional fields
added, and still keeping all referential integrity, autoincrement fields
etc. in tact.
I want to allow users of my databases to easily upgrade to a new database
which has additonal fields added, but still keeping their existing data
in tact.

Any ideas. pointers will be appreciated

Lester
lester.mas...@honeywell.co.za

 

Re:Copying database tables to new tables (haviing new fields)


In article <321DE75C.2...@honeywell.co.za>, From Lester Masher
<lester.mas...@honeywell.co.za>, the following was written:

Quote
> Can anyone tell me if there is a tool/utility which will allow me to
> copy my existing database tables to new tables which have additional
> fields added, and still keeping all referential integrity,
> autoincrement fields etc. in tact.
> I want to allow users of my databases to easily upgrade to a new
> database which has additonal fields added, but still keeping their
> existing data in tact.

> Any ideas. pointers will be appreciated

Take a look at the Insert command using a TQuery component(SQL
property).  You can insert all the fields for a record or just some.

INSERT INTO mytable (myfield1,myfield2...) VALUES(myvalue1,myvalue2...)
or with parameters(PARAMS property of the TQuery)

INSERT INTO mytable (FIRST_NAME, LAST_NAME, PHONE)
    VALUES(:fname, :lname, :phone_no)

Call the TQuery with:

Query1.Prepare;
Query1.ExecSQL;

    or for example 2

Query1.Params[0] := 'Jay';
Query1.Params[1] := 'Schwisow';
Query1.Params[2] := '330-2222';
Query1.Prepare;
Query1.ExecSQL;

God BLess,

--
Jay Schwisow j...@weldnet.com
08/24/96 14:16
---------
Using: OUI PRO 1.5.0.2 from http://www.dvorak.com

Other Threads