>The same problem is with SQL SELECT statement.
>
>use mytable in 0
>select recno('mytable') from mytable
>
>produces constant recno() values.
>
>However, if mytable is not opened prior to select:
>
>use in mytable
>select recno('mytable') from mytable
>
>recno() works correctly !
>
>Does'nt this smell like another bug ?
Yes and no. There's a general rule in SQL Select (and it obviously applies to SQL Update) that it uses the tables AGAIN internally, so any function which uses aliases will produce a result based on the alias outside the SQL statement, and not the one used inside. So, it will behave as a constant, because while the statement is executing, nothing is happening in that alias - record pointer doesn't move.
One thing I tried was to use internal aliases instead, but then while the statement is parsed, this alias doesn't exist yet, it's there only syntactically, for the private use of the parser.
select recno("lalias") from mytable lalias into cursor temp
gives "Alias is not found." error message. So, using EOF("somealias") will give you the status of that alias
outsode of the SQL statement.