Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Merging vfp table structures
Message
 
 
À
23/03/2009 18:50:47
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 7 SP1
OS:
Windows XP SP2
Divers
Thread ID:
01390885
Message ID:
01390886
Vues:
85
>Hi all,
>I need to create an empty cursor from multiple table structures.
>I was about ready to create some code using afields, ascan and alter table
>But I sure this is simple a SQL ?
>
>Any help? thanks.

I use this simple program to get cursor (or table) structure into the clipboard
********************************************************************
*  Description.......: FieldsToString - creates a string with fields in a table
*  Calling Samples...:
*  Parameter List....: tlAddTypes, tlAddAlias
*  Created by........: Nadya Nosonovsky 04/21/2005
*  Modified by.......: *-- CHANGE - NN - August 10, 2005 - 15:10:45
********************************************************************
FUNCTION FieldsToString
LPARAMETERS tlAddTypes, tlAddAlias

LOCAL lcStr, lnI, lnFields, laFields[1], lcType
lnFields = AFIELDS(laFields)
lcStr = ""

FOR lnI = 1 TO m.lnFields
	lcType = laFields[m.lnI,2]
	lcStr = m.lcStr + ", ;" + CHR(13) + CHR(10) + CHR(9) + ;
		IIF(m.tlAddAlias,ALIAS() + ".", "") + ;
		LOWER(LEFT(laFields[m.lnI, 1],1)) + ;
		PROPER(SUBSTR(laFields[m.lnI, 1],2)) + ;
		IIF(m.tlAddTypes, " " + m.lcType + ;
		IIF(NOT INLIST(m.lcType, "D","T","I","G","M","Y"), "(" + TRANSFORM(laFields[m.lnI,3]) + ;
		IIF(laFields[m.lnI,4] > 0, ", " + TRANSFORM(laFields[m.lnI,4]),"") + ")",""),"")
NEXT
_CLIPTEXT = m.lcStr
So, just run this program multiple times (merge cliptext) to get all your cursors/tables into the clipboard and then just add the CREATE CURSOR at the beginning and add ( ).
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform