Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How do I fill one field with several values
Message
 
 
À
05/03/2009 18:08:12
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
Database:
Visual FoxPro
Divers
Thread ID:
01385968
Message ID:
01386056
Vues:
51
>What if Table2.Column2 is a memo field? Does anything change, 254 characters are not going to be enough for the end result?

Kyle,

After reviewing your original request one more time, I realized that I misunderstood it. Here's the code that should give you result you want
* Preparing test data
CREATE CURSOR Table1 (Column1 C(5), Column2 C(5), Column3 C(20))

INSERT INTO Table1 VALUES("T001", "L001", "TEXT1")
INSERT INTO Table1 VALUES("T002", "L001", "TEXT2")
INSERT INTO Table1 VALUES("T003", "L001", "TEXT3")
INSERT INTO Table1 VALUES("T004", "L001", "TEXT4")
INSERT INTO Table1 VALUES("T005", "L002", "TEXT5")
INSERT INTO Table1 VALUES("T006", "L003", "TEXT6")
INSERT INTO Table1 VALUES("T007", "L003", "TEXT7")
INSERT INTO Table1 VALUES("T008", "L004", "TEXT8")
INSERT INTO Table1 VALUES("T009", "L004", "TEXT9")

CREATE CURSOR Table2 (Column1 C(5), Column2 M)

INSERT INTO Table2 (Column1) SELECT DISTINCT Column2 FROM Table1

*----- Update code starts here -----

UPDATE Table2 SET Column2 = ""

SELECT Table1
SCAN
	REPLACE Table2.Column2 WITH TRIM(Table2.Column2) + TRIM(Table1.Column1) + CHR(13) + CHR(10)+ ;
					TRIM(Table1.Column3) + CHR(13) + CHR(10) ;
		FOR Table2.Column1 = Table1.Column2 ; 			
		IN Table2		
ENDSCAN

SELECT Table2
BROWSE LAST NOWAIT		
--sb--
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform