Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 6 of 6 total
Thread Borrow table structure
Fri, Jul 28 2006 9:47 PMPermanent Link

Aldo Caruso
Hello,

  Is there a simple way to create a brand new table copying its
structure completely from another one ?
  I'm using DBISam 4.21 Build 7

Thanks in advance.
Aldo
Fri, Jul 28 2006 9:57 PMPermanent Link

Herb (Kraft)
Aldo Caruso <caruso@gia-sa.com> wrote:

Hello,

  Is there a simple way to create a brand new table copying its
structure completely from another one ?
  I'm using DBISam 4.21 Build 7

Thanks in advance.
Aldo
-----------------------------------------------

Yes- use DB SYS util which is free from Elevate. It is located on this site:

http://www.elevatesoft.com/scripts/download.dll?action=downinfo&producttype=add&version=4

Look at the bottom left, Borrow

Or, you can reverse engineer the table (also DB Sys util) into Pascal code or SQL and then
create a table programatically.

Herb
Fri, Jul 28 2006 10:29 PMPermanent Link

Aldo Caruso
Herb,

  Thanks, but I meant borrowing by code: A function or method where a
table could be created borrowing its structure from another one.

Aldo
Fri, Jul 28 2006 10:38 PMPermanent Link

"Johnnie Norsworthy"
"Aldo Caruso" <caruso@gia-sa.com> wrote in message
news:4BC0C6DB-B7DA-4F3B-BEC1-416B57254C5A@news.elevatesoft.com...
> Herb,
>
>   Thanks, but I meant borrowing by code: A function or method where a
> table could be created borrowing its structure from another one.

OldTable.Open;
NewTable.FieldDefs.Assign(OldTable.FieldDefs);
NewTable.IndexDefs.Assign(OldTable.IndexDefs);
OldTable.Close;
NewTable.CreateTable;

-Johnnie

Fri, Jul 28 2006 10:42 PMPermanent Link

Aldo Caruso
Thanks.
Sat, Jul 29 2006 11:47 AMPermanent Link

Aldo Caruso
Johnnie,

  I implemented your code and it works fine. Neverthless, for the sake
of completness, here is the code that makes an exact copy of the
original table structure.

  with SourceTable do
  begin
    Open;
    FieldDefs.Update;
    IndexDefs.Update;
    DestTable.FieldDefs.Assign(FieldDefs);
    DestTable.IndexDefs.Assign(IndexDefs);

DestTable.CreateTable(LocaleId,UserMajorVersion,UserMinorVersion,Encrypted,
      Password,Description,IndexPageSize,BlobBlockSize,LastAutoincValue,
      TextIndexFields,TextIndexStopWords,TextIndexSpaceChars,
      TextIndexIncludeChars);
    Close;
  end

Again, thank you very much for your support.

Aldo
Image