Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Automatically generating a 'create table' command
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00953298
Message ID:
00953364
Views:
16
>Has anyone written a 'Create Table command' generation program that will create that command by evaluating a real table?
>
>If so, do you mind sharing? We have several large tables (many fields) that we want to start creating programmatically, and I don't want to manually build the entire 'CREATE TABLE' command.
>
>Thanks, Michael

lol

If, on the other hand, you really wanted the actual text of the CREATE TABLE so you can embed it in a program (i.e., you aren't going to have the original table to look at) then you will need something else entirely. You could provide system copies of important tables that are simply used as the template for making the live copies (using something like that function) but I can see how you might prefer the hard coded method.

It wouldn't take much more to return a text string from a function based on the AFIELDS() array data of the original table during design time - then cut and paste the text into your program so you don't have to hand code it - and with intellisense you could even make it automatic if you wanted to (part of the IDE). It's all in AFIELDS() but the indexes. A simple CASE structure in the function to evaluate each array 'field' and concatenate the string till you have the whole table. There are only so many field types so it would be a small function too.
Steven D. Supinski
The American Contractor
Santa Cruz, CA 95062
Phone: (800) 333-8435 ext 4017
Email: ssupinski@theamericancontractor.com
Previous
Reply
Map
View

Click here to load this message in the networking platform