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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

tables from arrays

Status
Not open for further replies.

thepastor

Programmer
Jun 12, 2007
13
US
I have an array called "fldlst" created by afields() and I want to create a new table using that array. Can someone please give me the proper code for that?

Thanks;
 
Start VFP
in command windoe type HELP CREATE TABLE
Select CREATE TABLE - SQL Command

CREATE TABLE | DBF TableName1 [NAME LongTableName] [FREE]
[CODEPAGE = nCodePage]
( FieldName1 FieldType [( nFieldWidth [, nPrecision] )] [NULL | NOT NULL]
[CHECK lExpression1 [ERROR cMessageText1]]
[AUTOINC [NEXTVALUE NextValue [STEP StepValue]]] [DEFAULT eExpression1]
[PRIMARY KEY | UNIQUE [COLLATE cCollateSequence]]
[REFERENCES TableName2 [TAG TagName1]] [NOCPTRANS]
[, FieldName2 ... ]
[, PRIMARY KEY eExpression2 TAG TagName2 |, UNIQUE eExpression3 TAG TagName3
[COLLATE cCollateSequence]]
[, FOREIGN KEY eExpression4 TAG TagName4 [NODUP]
[COLLATE cCollateSequence]
REFERENCES TableName3 [TAG TagName5]] [, CHECK lExpression2 [ERROR cMessageText2]] )
| FROM ARRAY ArrayName


David W. Grewe Dave
 
ThePastor,

In fact, you only need the very first and last little bits of the syntax that David posted:

CREATE TABLE | DBF TableName1
FROM ARRAY ArrayName

But I can't argue with his main point. There's no substitute for reading the Help.

Mike



__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Thanks folks, the problem wasn't my code after all. The problem was an empty element in the array causing an error in the creation of the table.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top