>>I need a function that tells me that a character expression is a keyword, that is, a reserved word in VFP.
>>
>>I allow some limited changes to table structure and indexes. I need to check if the users has entered a reserved word for either.
>>
>>These can cause problems with SQL statements etc.
>>
>>If I have to write one does anyone have a table of reserved or Keywords?
>
>In general the keywords that SQL chokes on are not VFP keywords, but SQL keywords. You can avoid 99% of problems by makin sure fields are not SQL keywords:
>
>FUNCTION isSQLKeyWord
>tcWord
>tcWord = UPPER(ALLTRIM(tcWord))
>
>RETURN INLIST(tcWord, "SELECT", "FROM", "WHERE", "HAVING", "GROUP", "ORDER", "INTO","IN","BY","TOP","NOT","TABLE","CURSOR","ARRAY")
You might be bettor off putting the keywords in a one-field table so you can add to it. NUMBER, SUM, COUNT, etc., are also bad for field names.
Mark McCasland
Midlothian, TX USA