Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Update -- SQL --- error object not found
Message
From
10/06/2004 04:03:25
 
 
To
10/06/2004 01:52:22
Suhas Hegde
Dental Surgeon
Sirsi, India
General information
Forum:
Visual FoxPro
Category:
Visual FoxPro Beta
Miscellaneous
Thread ID:
00912088
Message ID:
00912102
Views:
8
Hi Suhas,

The syntax foo1.recno() is not supported. Moreover, the RECNO() function in SQL might cause unexpected results if more than one table/cursor is in scope. The following code appears to be doing the right thing, but I would consider to use primary or candidate key to join cursor to itself.
CLEAR 

CREATE CURSOR foo1 (f1 I , f2 I NULL,f3 I NULL)
INSERT INTO foo1 VALUES (1,10,0)
INSERT INTO foo1 VALUES (2,20,0)
INSERT INTO foo1 VALUES (5,50,0)
INSERT INTO foo1 VALUES (6,60,0)
INSERT INTO foo1 VALUES (7,70,0)
INSERT INTO foo1 VALUES (8,80,0)
INSERT INTO foo1 VALUES (9,90,0)
LIST 

UPDATE foo1 SET f1=afoo1.f2 , f2=afoo1.f1 ;
from foo1, (select *, RECNO() as nRecNo from foo1 ) as afoo1 ;
WHERE recno() = afoo1.nRecNo
LIST 
Thanks,
Aleksey.

>hi,
>Can this be done in the Update-- Sql ?
>
>CREATE CURSOR foo1 (f1 I , f2 I NULL,f3 I NULL)
>INSERT INTO foo1 VALUES (1,10,0)
>INSERT INTO foo1 VALUES (2,20,0)
>INSERT INTO foo1 VALUES (5,50,0)
>INSERT INTO foo1 VALUES (6,60,0)
>INSERT INTO foo1 VALUES (7,70,0)
>INSERT INTO foo1 VALUES (8,80,0)
>INSERT INTO foo1 VALUES (9,90,0)
>
>
>UPDATE foo1 SET f1=afoo1.f2 , f2=afoo1.f1 from foo1 afoo1 WHERE foo1.recno() = afoo1.recno()
>UPDATE foo1 SET f1=afoo1.f2 , f2=afoo1.f1 from (select * from foo1 ) as afoo1 WHERE foo1.recno() = afoo1.recno()
>
>Both returnerror " object afoo1 not found"
>
>
>After creating another cursor with name afoo1 and the same values and then still the same error ?? with
>
>UPDATE foo1 SET foo1.f1=afoo1.f2 ,foo1.f2=afoo1.f1 from afoo1 WHERE foo1.recno() = afoo1.recno()
>
>Is Recno() not recognised as a where clause or Should it be something else ?
>
>Suhas.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform