Hi Mike
Under no circumstances do I use DELETED() or RECNO() in SQL. SQL
re-opens the tables you started with.
So if you had TableA in workarea 1 and TableB in workarea 2, when your
SQL starts it re-opens TableA and TableB temporarily in new work
areas.
If you then refer to DELETED("TABLEA") or RECNO("TABLEB"), those
function calls can refer to the original tableA and even the current
record in TableB. The help specifically states:
"Use caution when using functions such as DELETED( ), EOF( ), FOUND(
), RECCOUNT( ), and RECNO( ), which support an optional alias or work
area. Including an alias or work area in these functions might yield
unexpected results."
I take that to heart and NEVER use these functions in VFP SQL.
If you want to hide deleted records from SQL, SET DELETED ON, then do
the SQL. You can use RECNO() when you run SQL on only one table, no
joins - and Rushmore is not going to go "haywire". That is too
restrictive a situation for my liking.
Mike Yearwood
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
> Of MB Software Solutions General Account
> Sent: 20 March 2008 20:03
> To: ProFox Email List
> Subject: Using RECNO in SELECT-SQL statements
>
> (finally...a VFP post!)
>
> We've got a bug SOMEWHERE in this legacy code but it's a very difficult
> bug to recreate. iow, it only appears SOMETIMES and has no consistency
> whatsoever. This code creates a lot of temp tables locally (instead of
> cursors...why can I only guess that perhaps they didn't have cursors way
> back when in Fox or its predecessor...???), and often use "..., RECNO()
> as recno" as one of the fields.
>
> Are there any known gotchas in using RECNOs in a VFP SELECT-SQL
> statement? We're using VFP9SP1 but this is legacy code from many years
> ago, fwiw.
>
> tia,
> --Michael
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/[EMAIL PROTECTED]
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.