Board index » off-topic » Re: Add indexed fields

Re: Add indexed fields


2004-11-18 09:37:51 PM
off-topic10
use the SQL ALTER TABLE command to add the fields and the CREATE INDEX
command to add the index. See the Local SQL help file for details.
--
Bill (TeamB)
TeamB cannot answer questions received via email
Stephen M wrote:
Quote
Hi,

Using Delphi 7, BDE and paradox tables, Is there a way to add
indexed fields (like datestamp, integer) in an existing table at run
time?

Thank's
 
 

Re:Re: Add indexed fields

Hi,
Using Delphi 7, BDE and paradox tables, Is there a way to add indexed
fields (like datestamp, integer) in an existing table at run time?
Thank's
 

Re:Re: Add indexed fields

Hi,
Ok, I did that but is possible to add the new fields as part of the primary
key?
?"Bill Todd" < XXXX@XXXXX.COM >έγραψε στ?μήνυμα
Quote
use the SQL ALTER TABLE command to add the fields and the CREATE INDEX
command to add the index. See the Local SQL help file for details.

--
Bill (TeamB)
TeamB cannot answer questions received via email

Stephen M wrote:

>Hi,
>
>Using Delphi 7, BDE and paradox tables, Is there a way to add
>indexed fields (like datestamp, integer) in an existing table at run
>time?
>
>Thank's
 

{smallsort}

Re:Re: Add indexed fields

Here's soon good solid advice. Rethink your design...
It's better that you make ALL your keys be single field non meaningfull
data. I say this regardless of the database you use. All database
systems have a way to do this. With Paradox tables typically you use an
autoinc field. Do this and you will save yourself headaches down the road.
Stephen M wrote:
Quote
Hi,

Ok, I did that but is possible to add the new fields as part of the primary
key?

?"Bill Todd" < XXXX@XXXXX.COM >έγραψε στ?μήνυμα
news: XXXX@XXXXX.COM ...

>use the SQL ALTER TABLE command to add the fields and the CREATE INDEX
>command to add the index. See the Local SQL help file for details.
>
>--
>Bill (TeamB)
>TeamB cannot answer questions received via email
>
>Stephen M wrote:
>
>
>>Hi,
>>
>>Using Delphi 7, BDE and paradox tables, Is there a way to add
>>indexed fields (like datestamp, integer) in an existing table at run
>>time?
>>
>>Thank's



 

Re:Re: Add indexed fields

Quinn Wildman wrote:
Quote
With Paradox tables typically you use an autoinc field. Do this and you will
save yourself headaches down the road.
I've lost track of the number of times I've seen disaster, when a table with an
autoinc gets damaged.. especially bad if it's part of a master-detail.. much
better to "roll your own" or use somebody else's "next number" process.. it's too
easy..
Diamond Software Group
www.diamondsg.com/main.htm
Paradox Support & Sales - Corel CTech Paradox
---------------------------------------------------
Diamond Sports Gems
www.diamondsg.com/gemsmain.htm
Trading Cards and other Sports Memorabilia
---------------------------------------------------
 

Re:Re: Add indexed fields

Hi,
The problem is that the exixting keys MUST stay as they are (because of
master/detail relations and other features that the application provides
etc.).
Two new fields (TIMESTAMP and INTEGER) must be added as the last keys of the
primary key. I am considering DbiDoRestructure function of the BDE as an
alternative way of SQL ALTER TABLE. Now I am searching for more info...
 

Re:Re: Add indexed fields

Autoinc isn't the only way to generate an single field non meaningfull
key. Just make sure you create a single field non meaningful key. How
you decide to implement this is up to you.
Steven Green wrote:
Quote
Quinn Wildman wrote:


>With Paradox tables typically you use an autoinc field. Do this and you will
>save yourself headaches down the road.


I've lost track of the number of times I've seen disaster, when a table with an
autoinc gets damaged.. especially bad if it's part of a master-detail.. much
better to "roll your own" or use somebody else's "next number" process.. it's too
easy..


--
Steven Green - Waldorf Maryland USA

Diamond Software Group
www.diamondsg.com/main.htm
Paradox Support & Sales - Corel CTech Paradox
---------------------------------------------------
Diamond Sports Gems
www.diamondsg.com/gemsmain.htm
Trading Cards and other Sports Memorabilia
---------------------------------------------------


 

Re:Re: Add indexed fields

With Paradox, the fields in your primary key must be the first fields in
your table (and have the same order in the table that they do in the primary
key). Probably the easiest thing would be to create a new table with the
structure you want, copy the data (adding in values for the 2 extra fields)
from the old to the new table, delete the old table, and then rename the new
table.
While DbiDoRestructure will allow you to change your primary key, I don't
think it can re-arrange the order of columns which is something you'd need
to do in order to add brand new columns to your primary key.