Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Cannot change cursor column name
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
01646543
Message ID:
01646608
Views:
38
>>>>>UPDATE. I found the cause of the problem. When the column name is greater than 10 characters, you cannot change it. Strange though that VFP allows creating a cursor with a column with the name greater than 10 char, but won't allow to change the name.
>>>>>
>>>>>Hi,
>>>>>
>>>>>I want to change a cursor column name. When I do it in the Command window, it works. Here is the code:
>>>>>
>>>>>cCursorName = "MyCursor"
>>>>>cFieldFrom = "FieldName1"
>>>>>cFieldTo = "FieldName2"
>>>>>alter table (cCursorName) rename (cFieldFrom) to (cFieldTo)
>>>>>
>>>>>So the above works without a problem in the Command window.
>>>>>
>>>>>But when I have pretty much the same code in the .PRG of the program, I get error:
>>>>>
>>>>>Error 1115
>>>>>Invalid Operation for the Cursor
>>>>>
>>>>>
>>>>>Could someone explain why? TIA
>>>>
>>>>How did you create the cursor?
>>>
>>>
>>>create cursor mycursor (description c(50))
>>>
>>>
>>>Note that the field name is greater than 10 char. And I could not change the name.
>>
>>This is a bug for me, but why you need to rename the field in CURSOR?
>>Just create the cursor with the field names you want :-)
>
>I am sure that VFP team will fix it in version 10.0 :).
>
>As to why?. I have to populate this cursor from a json I get in Web API. The method I use from West Wind Client Tools requires that the cursor has exactly the same names as the names in the json. And this json has a name "Description". So I have to get it into a cursor with this name and then change it to something less than 10 char. Because I need to save this cursor as a free table to the drive. And when you save a cursor with a field name longer than 10 char, it cuts the name to 10 char (becomes DESCRIPTIO).
SELECT ..., Description AS Desc FROM .. READWRITE
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform