Board index » delphi » How to compare two tables' structures

How to compare two tables' structures

Hi,

Is there an "easy" way to compare two table structures?  We're trying to
check the table structures of a software under development and need to
check if the client tables structures are up to date.  Sometimes there
are new fields, or size changes, etc.

Thanks,
Victor H. Ulloa
from Tierra Fertil S.A.

 

Re:How to compare two tables' structures


I would build two string lists out of:

for fld_num := 1 to mytable.fieldcount
  tablestruct.add(mytable.fields[fld_num]) ;
end ;

(and then maybe sort them), and then compare them.

.....................
Richard Grossman
rgross...@techIII.com

Re:How to compare two tables' structures


Quote
Richard Grossman wrote:
> I would build two string lists out of:

> for fld_num := 1 to mytable.fieldcount
>   tablestruct.add(mytable.fields[fld_num]) ;
> end ;

> (and then maybe sort them), and then compare them.

> .....................
> Richard Grossman
> rgross...@techIII.com

Thanks, Richard, maybe I must be more explicit:  I'm writing a function
to check for the installation of a system.  What I need is to update the
tables without loosing information (but there can be new fields, or
modified ones, new or different constrains, new or modified indexes,
etc).

So what I'm doing now is to TBatchMove data from the old table structure
to the new and then replacing old table.

Thanks again

Victor H. Ulloa
Tierra Fertil S.A.

Re:How to compare two tables' structures


Take a look at EZDataInstall at www.aljan.com.au/~damian

Re:How to compare two tables' structures


Quote
Bruce Roberts wrote:
> Take a look at EZDataInstall at www.aljan.com.au/~damian

Thanks Bruce! Very useful.

Victor H. Ulloa
Tierra Fertil S.A.

Re:How to compare two tables' structures


Victor:

The EZDataInstall site doesn't mention Referential-Integrity
constraints.  If you have defined some R-I and need it preserved in your
databases, or you add R-I to an updated version of your program, you
_may_ need to look elsewhere.

I'm working with the same problem that you are facing, and I'm looking
at a product called Table Scanner.

New versions of this program can be found at
http://www.gold.com.br/~demian/
Comments, criticisms, bugs and suggestions can be sent to
dem...@gold.com.br

This program is a lot more involved than EZDataInstall, but it's
approach looks like it will do any and all updates that are possible
within the BDE.

mIKE

Other Threads