Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Record not selected by a SQL query
Message
From
14/11/2018 09:59:42
Mike Yearwood
Toronto, Ontario, Canada
 
 
To
09/11/2018 12:59:07
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP2
Miscellaneous
Thread ID:
01662848
Message ID:
01663342
Views:
47
Hi Rick

How have you been?

I try to avoid edge cases. RECNO() only works in a query on a single alias. That's too limiting for me. If you don't have a good PK, you have to resort to weird approaches to get around that.
A sequential GUID primary key is always unique to each table and across multiple tables and even across multiple systems. That's the widest possible application.

>>I did not test it as a view definition, only as a query. I was surprised that it was working in VFP, but aparently as view it does not allow this syntax?
>
>I don't think so. It may be another syntax I haven't tried, but so far no go.
>
>>>I tried various combinations today in one of our views, and could not get it to work.
>>>
>>>Are you able to get it to work? If so, what is the syntax you used?
>>>
>>>Did not work:
>>>
* Syntax:
>>>SELECT a.* ;
>>>    ;
>>>    FROM  ;
>>>        (SELECT RECNO() as nRecno, * FROM addr) a ;
>>>    ;
>>>    WHERE  a.iaddrid = ( ?vp_iaddrid )
>>>
>>>* Syntax:
>>>SELECT a.* ;
>>>    ;
>>>    FROM ;
>>>        (SELECT RECNO() as nRecno, * ;
>>>             FROM addr ;
>>>             WHERE  addr.iaddrid = ( ?vp_iaddrid ) ;
>>>        ) a
>>>
>>>
>>>I get "Not a character expression" on each attempt, and it asks me if I want to rebuild the view from the designer.
>>>
>>>>>When I've needed RECNO() values, I've selected from the original table with something like:
>>>
SELECT RECNO() as nRecno, * FROM table INTO CURSOR c_table
>>>>>
>>>>>And then used that as the source for my subsequent query. Doesn't work well in views though, but can be a good workaround if it's manual code.
>>>>
>>>>I wonder if something like this would be working for a view. I have not used views in a long time but could be interesting.
>>>>
>>>
>>>SELECT Test.Inv_Recno, Inv.Invnum, Par.Parnum 
>>>    FROM (SELECT RECNO() AS Inv_Recno, Invnum, Parnum 
>>>        FROM Inv 
>>>        WHERE Parnum== "000001") Test 
>>>    JOIN Par ON Test.Parnum == Par.Parnum 
>>>    JOIN Inv ON Inv.Invnum == Test.Invnum AND Inv.Parnum == Test.Parnum 
>>>    INTO CURSOR cuResult 
>>>
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform