Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Help with SPT code
Message
De
07/08/2002 08:59:42
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
07/08/2002 08:33:43
Steven Dyke
Safran Seats USA
Texas, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00686974
Message ID:
00686992
Vues:
33
>I need a way to run an SPT statement(AS400) and then use the result to run a second SPT.
>
>For example: I am looking for hardware that is listed by several base numbers. Each base number has multiple lines for a description so one pass through won't get the result I need. Say my parameter is 'SCREW'. I run the first SPT to get all the base numbers that have screw in the description. Then I need to take these numbers and do a second SPT to get the multiple records that go with these numbers.
>
>Right now I can get this second SPT to work provided it only has a few numbers to look at. This is because of the string limitation. What I do is loop through the first result creating a string "'WAXXX' Or 'WAXX1' Or 'WAXX2' Or 'WAXX3'" etc. I then use this in my SPT as this:
>= SQLPREPARE(gnHandle1, "Select * From wamtxt Where &mfrt2b", 'mySeeThis1')
>
>I need a way to break this string into smaller strings which I know how to do with separate variables but not a single string.

Steve,
Doesn't that still basically one SQL ? ie:

select * from myTable where baseNum in ;
(select baseNum from myHardware where myField='SCREW')

* or using exists

However for breaking string question, first do not use macro substitution :

SQLPREPARE(gnHandle1, ;
"Select * From wamtxt Where "+lcStr1+lcStr2+lcStr3..+lcStrn, 'mySeeThis1')

string limit is 255 only for literal strings.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform