How to Create a Table that Has Many Fields of Identical Size

ID: Q139527

3.00 WINDOWS

 kbhowto

The information in this article applies to:
  • Microsoft Visual FoxPro for Windows, version 3.0

SUMMARY

Creating tables that contain many fields can be time consuming, especially if all the fields have the same type and size. With a few lines of code, the table can be created easily.

MORE INFORMATION

The following program creates a table called newtable that has 200 fields, each defined as a character field of size 20:

   lnTblstr="("
   FOR lnI=1 to 200
     lnTblstr=lnTblstr+"FLD"+ALLTRIM(STR(lnI))+" C(20),"
   ENDFOR
   lnTblstr=STUFF(lnTblstr,LEN(lnTblstr),1,")")
   CREATE TABLE newtable FREE &lnTblstr

Additional reference words: 3.00 VFoxWin kbhowto KBCategory: kbhowto KBSubcategory: FxprgTable
Keywords          : kbcode FxprgTable 
Version           : 3.00
Platform          : WINDOWS


Last Reviewed: May 22, 1998
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.