Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL 'exclude' ???
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00084164
Message ID:
00084173
Vues:
20
>I have a VFP table that has 60 fields. Instead of listing all of the fields I want for my resultant data, is there a way to say, give me all of the fields except for (unwanted fields).
>
>i.e(select * from county EXCLUDE ; county.street,county.name,county.test)
>
>Thanks for any help
>
>John

If you like quirky solutions, this is one possible:
use table1   && this is your table
=afields(aStru)
public array aFieldnames(alen(aStru,1))
for nLoop=1 to alen(aStru,1)
 aFieldnames[nLoop]=aStru[nLoop,1]
endfor
=excludefield("usedyr")   && supply field name to be excluded
cFields=""
for nLoop=1 to alen(aFieldnames)
 cFieldname=aFieldnames[nloop]
 if type("cFieldname")="C"
  cFields=cFields+cFieldname+","
 endif
endfor
cFields=left(cFields,len(cFields)-1)
select &cFields From sqlfinal
release aFieldnames
return

function excludefield
lparameter cFieldname
local nPos
nPos=ascan(aFieldnames,upper(cFieldname))
if nPos>0
 =adel(aFieldnames,nPos)
endif
return
Edward Pikman
Independent Consultant
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform