Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Columns
Message
From
28/10/2002 15:22:20
 
 
To
28/10/2002 15:02:30
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00716154
Message ID:
00716170
Views:
25
This message has been marked as the solution to the initial question of the thread.
USE MyTable SHARED IN 0
FldsCnt = AFIELDS (aFlds, "MyTable")
FldExist = .F.

FOR I = 1 TO FldsCnt
   IF aFlds [I, 1] == "MYCOL"
      FldExist = .T.
      EXIT
   ENDIF
ENDFOR

IF NOT FldExist
   USE IN MyTable
   USE MyTable EXCLUSIVE IN 0
   ALTER TABLE MyTable ADD COLUMN MyCol C (20)
   USE IN MyTable
ENDIF
HTH

>I need code that will do the following:
>
>1. Check to see if a column (field) exists in a table.
> 1a. If the column does exist, then exit.
> 1b. If the column does NOT exist, then add the column to the table.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform