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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL alter table / macro subst 1

Status
Not open for further replies.

MrFancyteeth

Programmer
Mar 18, 2003
90
GB
I'm trying to create a common structure for several dbf files. The Fieldname,Fieldtype and fieldwidth are stored in a cursor.

i'm then scanning through the cursor and using SQL alter table to modify and existing table structure

SELECT curstrus
scan

cfname=curstrus.fname
cftype=curstrus.ftype
nfsize=curstrus.fsize

ALTER TABLE tabresult ADD COLUMN &fname &ftype(&nfsize)

ENDSCAN

The problem occurs in the field size (&nfsize) part

any ideas?

mrF
 
Try create string

zm_s='ALTER TABLE tabresult ADD COLUMN '+alltrim(fname)+' '+alltrim(ftype)+'('+alltrim(str(nfsize))+')'
&zm_s



Monika from Warszawa (Poland)
(monikai@yahoo.com)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top