Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How can I drop a column from a cursor?
Message
From
08/10/2005 06:40:40
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
08/10/2005 05:53:42
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01057403
Message ID:
01057424
Views:
10
>>
>>>Hi Everybody,
>>> Learnt from error message that command Alter Table mycursorname Drop a_column_name is invaild to a cursor,but i sometimes do need so to do.
>>
>>Aaron,
>>You can use 'alter table' with cursors.
>>Steven,
>>To be able to use 'alter table' you need a readwrite cursor, cursor should not be an SPT cursor and should not have any long field names in it. ie:
>>
>>select * from customer into cursor myCursor readwrite
>>alter table myCursor ;
>> drop column contact ;
>> drop column title ;
>> drop column address
>>browse
>>
>>Hi Cetin,
>> Unfortunately, what i mentioned happenedly is for SPT cursor.the fields of cursor are dynamically generated at side of SQL Server,in which there is a redundant column as relationship field,couldn't be removed at side of SQL.
>>Thus i want to remove it at VFP client.Any further ideas on conveting a SPT cursor into a general cursor? Certainly, it can be clone as real dbf then generate another cursor,but i don't like this way.:)
>
>>Why you can't remove on SQL side? Even if you can't why there is a need to remove?
>
>Hi Cetin,
> I really can't ;),because there are 2 PIVOT temp tables combined into one cursor linked with mentioned primarykey field with dynamic SQL statement,like this :-"... Select a.*,b.* from #temp_1 a left join #temp_2 on a.keyfield=b.keyfield"
> For 2nd why,the result cursor is friendly displayed to user bound to a grid,and user will export it into a excel file.Certainly, I already could remove the column with grid control workaround. I just want to seek for another best bet based on background cursor.
> I have been getting many knowledge from your answers to other asker,many thanks to you.

You really can:)
Select a.FieldName1, a.FieldName2, ;
 b.FieldNameWhatever1, ;
 b.FieldNameWhatever2 as WhateverYouLike ;
 from #temp_1 a left join #temp_2 on a.keyfield=b.keyfield
2nd as you said you can control what you grid would show and what would bve sent to excel. Excel pivot tables are easily created with ADO transfers and your cursor need not be open after you send.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform