I found out the stored procedure but how do I identify if the field type is charactr or integer. This is what i am using in the stored procedure.
PROCEDURE DefaultsALL
USE qtk EXCLUSIVE
FOR i = 1 TO FCOUNT()
fieldname = FIELD(i)
ALTER TABLE Qtk ALTER COLUMN (fieldname) set Default ' '
ENDFOR
ENDPROC
I am looking for something like this to put in this stored procedure. Is somthing like this exists in stored procedure for fox pro. I am bery new to fox pro and this is the first time i am looking at stored procedures.
PROCEDURE DefaultsALL
USE qtk EXCLUSIVE
FOR i = 1 TO FCOUNT()
fieldname = FIELD(i)
fieldtype= ftype()'don't know if this exists
if fieldtype= Integer then
ALTER TABLE Qtk ALTER COLUMN (fieldname) set Default 0
elseif fieldtype= Char then
ALTER TABLE Qtk ALTER COLUMN (fieldname) set Default ''
Replace the line with FType() with my code suggestion. Use the return value (one character describing the data type) in your IF...ELSE...IF structure, or better yet use a CASE structure. (see the Help file for the DO CASE command and the TYPE() function for all the possibilities of data types in VFP.
hi, i really apprecaite guidance here... I did what you suggested but when i execute it, i get an error "syntax error"
PROCEDURE DefaultsALL
USE qtk EXCLUSIVE
FOR i = 1 TO FCOUNT()
fieldname = FIELD(i)
do case TYPE(i)
case 'C'
ALTER TABLE Qtk ALTER COLUMN (fieldname) set default ''
case 'N'
ALTER TABLE Qtk ALTER COLUMN (fieldname) set default 0
ENDCASE
ENDFOR
ENDPROC
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.