Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Automatically generating a 'create table' command
Message
From
22/10/2004 18:41:30
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00953298
Message ID:
00953908
Views:
16
Don't know if this has been mentioned, but dbcgen.prg will do just that - be careful, though, running it will create BLANK tables hosing existing data.

The code in the prg however will give you a pretty good idea of how it works.

but better yet, use Stonefield - it will generate tables on startup from metadata if the table doesn't exist and fix its structure to match dbc changes if you've made them to for existing tables. A must-use in my opinion


>Thanks, everyone:
>
>Here is what I was hoping to do:
>
>I want to add the CREATE TABLE command to my code so that the tables get created at run time without requiring that one exists yet. I want to start doing that for all my temp tables that are used for imports, etc.
>
>I can certainly manually write the CREATE TABLE commands for each of these tables, but what a pain, especially for some tables that have a ton of fields (one has 240 fields). Most of these tables already exsist, so I was hoping that someone had written a program that could examine the table structure and build the 'CREATE TABLE' command for me.
>
>I can write it myself, I have written a program that will compare one free DBF against another and builds a program to correct the table that is missing fields using ALTER TABLE - I was just hoping someone out there in the great world of Universal Thread has already done this.
>
>Thanks for all your advice,
>
>Michael


Charles Hankey

Though a good deal is too strange to be believed, nothing is too strange to have happened.
- Thomas Hardy

Half the harm that is done in this world is due to people who want to feel important. They don't mean to do harm-- but the harm does not interest them. Or they do not see it, or they justify it because they are absorbed in the endless struggle to think well of themselves.

-- T. S. Eliot
Democracy is two wolves and a sheep voting on what to have for lunch.
Liberty is a well-armed sheep contesting the vote.
- Ben Franklin

Pardon him, Theodotus. He is a barbarian, and thinks that the customs of his tribe and island are the laws of nature.
Previous
Reply
Map
View

Click here to load this message in the networking platform