Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Field Selection in Query

Status
Not open for further replies.

dzdncnfsd

MIS
Jul 14, 2000
118
US
How do I select all but one or two fields from a table without having to write out "Select loan_num, name, payment from loans"? I have a table with a lot of fields and I want all but two of them included in my query. (VFP 5.0)
Thanks,
Gladys

Gladys Clemmer
gladys.clemmer@fifsg.com

 
Hi my friend
Try this..
Code:
lcMySelectedItems = MYSELECT()
SELECT &lcMySelectedItems FROM REMBATCH

FUNCTION MYSELECT
*// This function will return a string of all the fields *// you want to include in your query.
lcReturnVal=""
FOR X=1 to FCOUNT()
  IF FIELD(x)="CADD_USER" &&/* The field you don't want */
    LOOP
  ENDIF
  lcReturnVal=lcReturnVal+FIELD(x)+IIF(X=FCOUNT(),"",",")
ENDFOR
RETURN lcReturnVa
 
Thanks, Walid. I will try your method. Today, though, I took the easy way out and pulled all fields into a cursor then copied out to an Excel spreadsheet to get rid of the memo fields which is what I wanted to do in the first place. Since that won't work in every case, it is good to have another way to exclude unwanted fields.
Have a great day!!
Gladys

Gladys Clemmer
gladys.clemmer@fifsg.com

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top