Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Restructuring a table

Status
Not open for further replies.

wcochran

Technical User
Feb 26, 2004
1
US
I have done a lot of things with Paradox over the years, but I now have a problem that stumps me.

Using ObjectPal, I need to restructure a table in a way that moves a field from one spot to another. (I know how to add and delete fields, but this one has me scratching my head after several hours of t&e.

Thanks.

Wendell Cochran
 
Hmmm. It might be simpler just to create a new table using ObjectPAL that has the field structure/order you want, then use a tCursor set to move the data over from the original table.

Mac :)

"There are only 10 kinds of people in this world... those who understand binary and those who don't"

langley_mckelvy@cd4.co.harris.tx.us
 
I have spent a fair amount of time trying to run a restructure through OPAL, has not worked very well. Why do you need to change where a field exists? You might look at the TABLEMAN.ZIP app here:


It is a fairly interesting util that allows you to see all your tables and their structure. It is supposted to allow you to change the structure and it is an FSL so you can review their code.

I just wrote a method that reviewed the table language and block size for each table in my app (285 and counting) and updated them all to version 7, block size 16. Doesn't really do what you want. When I was trying to do that, it was to update clients with the latest version of our software. I do have a routine that I use that compares the table structure between two alias's and then creates a table where they differ. You can then manually push a button that takes you into the restucture of either table. Be glad to share if that will help.

James D. Howard
 
Dumb question..couldn't you just use a query? Then it should be relatively easy.
 
Wendell,

ObjectPAL's restructure interface is notorious for not being well documented, as well as being a bit, um, finicky about certain things.

I think Mac is on the right track. I'd trying something along these lines:

1. Use a Table variable to obtain an array of field and types from the existing table.

2. Use standard variable assignment to swap the two fields you need to change.

3. Create a new table with the modified array.

4. (Optionally) Add indexes as needed.

5. Add the data from the original table to the new table.

Alternatively, you could create the alternate table yourself and then manage its contents as needed, e.g. treat it as a temporary table necessary for the underlying operations. In my experience, ths is the fastest thing to achieve, though it does mean you'll have another table to contend with.

Hope this helps...

-- Lance
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top