Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Automatically generating a 'create table' command
Message
 
À
21/10/2004 11:32:54
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00953298
Message ID:
00953536
Vues:
13
>You mentioned CREATE YABLE, what's wrong with that command? I understood from your message that you wanted another solution?
>
>>Thanks, but I was hoping to start building the tables programmatically rather than have one living. We distribute this application and I need to create this table on each work station.


having your actual tables in a dir try to use this code and add some functionality to do all the tables at the same time
USE yourTable

COPY STRUCTURE TO yourTableStructure extende 

SELECT 0 
USE yourTableStructure
LOCAL lcSQLCreateTbl
lcSQLCreateTbl = "create table " + ALLTRIM(yourTableStructure.Table_name) + " ("
SCAN
	lcSQLCreateTbl = lcSQLCreateTbl + ALLTRIM(yourTableStructure.field_name) + " " + yourTableStructure.Field_Type + ;
									  [(] + ALLTRIM(STR(yourTableStructure.Field_Len)) + ;
									  IIF(yourTableStructure.Field_Type = 'N', [,] + ALLTRIM(STR(yourTableStructure.Field_dec)),"") + [),]
ENDSCAN
lcSQLCreateTbl = LEFT(lcSQLCreateTbl,LEN(lcSQLCreateTbl) - 1) + ")"
? lcSQLCreateTbl
CLOSE ALL
.......
DO WHILE .T.
      ME.Work()
ENDDO
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform