Re: Appending from a Cursor

2018-04-12 Thread Gene Wirchenko

At 06:21 2018-04-12, Alan Bourke  wrote:

On Thu, 12 Apr 2018, at 1:31 PM, Jean MAURICE wrote:
> Hi Gene,
>
> 'append from' appends data from a file on the disk and a cursor 
is not a file !


A cursor may or may not have a disk presence depending on various factors.

But SQL is a a better way to do it.

insert into mytable (f1, f2, f3) select (f1, f2, f3) from mycursor


 That was the way I ended up doing it.

Sincerely,

Gene Wirchenko


___
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/5463394478cbd485ba003006c1922a27@mtlp85
** 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.


Re: Appending from a Cursor

2018-04-12 Thread Paul H. Tarver
I was planning a similar test to get some sense of the quantifiable difference 
but you did a great job, Dave! The verdict is in and ‘Insert into’ wins hands 
down!

That’s what happens when you dangle Foxpro problems in this group. It’s like 
bait we can’t resist!

Thanks!
Paul

Sent from my iPhone

> On Apr 12, 2018, at 11:49 AM, Dave Crozier  wrote:
> 
> Paul,
> I have been interested in testing this out myself, so in the interests of all 
> I just ran a test inserting a 2,000,000 record table into another table with 
> an integer PK index and a 20 character index (ID field) and the SQL Insert 
> runs 75% quicker but only 25% quicker if the "select(" (suggested by Alan) 
> for the inserted records is either a physical table or a readwrite cursor.
> 
> I suppose this confirms that using cursors to pre-fetch your data into memory 
> is significantly faster for insertions as the required records are either in 
> memory completely or filtered by VFP. As we all know making a cursor 
> readwrite effectively makes a cursor perform the same as a physical table as 
> it causes VFP to create a physical "table" which would appear to 
> significantly degrade performance - understandable.
> 
> Hope this makes sense... have to go, made myself late for dinner, so if not 
> I'll explain better tomorrow!!
> 
> Dave Crozier
> Software Development Manager
> Flexipol Packaging Ltd.
> 
> 
> 
> ---
> This communication and the information it contains is intended for the person 
> or organisation to whom it is addressed. Its contents are confidential and 
> may be protected in law. If you have received this e-mail in error you must 
> not copy, distribute or take any action in reliance on it. Unauthorised use, 
> copying or disclosure of any of it may be unlawful. If you have received this 
> message in error, please notify us immediately by telephone or email.
> 
> Flexipol Packaging Ltd. has taken every reasonable precaution to minimise the 
> risk of virus transmission through email and therefore any files sent via 
> e-mail will have been checked for known viruses. However, you are advised to 
> run your own virus check before opening any
> attachments received as Flexipol Packaging Ltd will not in any event accept 
> any liability whatsoever once an e-mail and/or any attachment is received.
> 
> It is the responsibility of the recipient to ensure that they have adequate 
> virus protection.
> 
> Flexipol Packaging Ltd.
> Unit 14 Bentwood Road
> Carrs
> Industrial Estate
> Haslingden
> Rossendale
> Lancashire
> BB4 5HH
> 
> Tel:01706-222792
> Fax: 01706-224683
> www.Flexipol.co.uk
> ---
> 
> Terms & Conditions:
> 
> Notwithstanding delivery and the passing of risk in the goods, the property 
> in the goods shall not pass to the buyer until the seller
> Flexipol Packaging Ltd. ("The Company") has received in cash or cleared funds 
> payment in full of the price of the goods and all other goods agreed to be 
> sold by the seller to the buyer for which payment is then due. Until such 
> time as the property in the goods passes to the buyer, the buyer shall hold 
> the goods as the seller's fiduciary agent and bailee and keep the goods 
> separate from those of the buyer and third parties and properly stored 
> protected and insured and identified as the seller's property but shall be 
> entitled to resell or use the goods in the ordinary course of its business. 
> Until such time as the property in the goods passes to the buyer the seller 
> shall be entitled at any time
> 
> -Original Message-
> From: ProFox  On Behalf Of Paul H. Tarver
> Sent: 12 April 2018 14:19
> To: profox@leafe.com
> Subject: RE: Appending from a Cursor
> 
> Ok, so let me ask the $64,000 question: Which method is faster or better:
> Append From DBF( or Insert Into as Gene used?
> 
> I have a similar project were I am issuing the same query to multiple SQL 
> databases/servers and then using the Append From DBF( command to aggregate 
> the results from each individual query into a large, single cursor to use for 
> actual processing.
> 
> I'm traveling today or I'd test this myself, but I have limited access.
> Figured I'd see if anyone else had already determined the best choice before 
> I go poking around on my own.
> 
> Paul
> 
> -Original Message-
> From: ProfoxTech [mailto:profoxtech-boun...@leafe.com] On Behalf Of Ted Roche
> Sent: Thursday, April 12, 2018 6:18 AM
> To: profoxt...@leafe.com
> Subject: Re: Appending from a Cursor
> 
>> On Wed, Apr 1

RE: Appending from a Cursor

2018-04-12 Thread Dave Crozier
Paul,
I have been interested in testing this out myself, so in the interests of all I 
just ran a test inserting a 2,000,000 record table into another table with an 
integer PK index and a 20 character index (ID field) and the SQL Insert runs 
75% quicker but only 25% quicker if the "select(" (suggested by Alan) for the 
inserted records is either a physical table or a readwrite cursor.

I suppose this confirms that using cursors to pre-fetch your data into memory 
is significantly faster for insertions as the required records are either in 
memory completely or filtered by VFP. As we all know making a cursor readwrite 
effectively makes a cursor perform the same as a physical table as it causes 
VFP to create a physical "table" which would appear to significantly degrade 
performance - understandable.

Hope this makes sense... have to go, made myself late for dinner, so if not 
I'll explain better tomorrow!!

Dave Crozier
Software Development Manager
Flexipol Packaging Ltd.



---
This communication and the information it contains is intended for the person 
or organisation to whom it is addressed. Its contents are confidential and may 
be protected in law. If you have received this e-mail in error you must not 
copy, distribute or take any action in reliance on it. Unauthorised use, 
copying or disclosure of any of it may be unlawful. If you have received this 
message in error, please notify us immediately by telephone or email.

Flexipol Packaging Ltd. has taken every reasonable precaution to minimise the 
risk of virus transmission through email and therefore any files sent via 
e-mail will have been checked for known viruses. However, you are advised to 
run your own virus check before opening any
attachments received as Flexipol Packaging Ltd will not in any event accept any 
liability whatsoever once an e-mail and/or any attachment is received.

It is the responsibility of the recipient to ensure that they have adequate 
virus protection.

Flexipol Packaging Ltd.
Unit 14 Bentwood Road
Carrs
Industrial Estate
Haslingden
Rossendale
Lancashire
BB4 5HH

Tel:01706-222792
Fax: 01706-224683
www.Flexipol.co.uk
---

Terms & Conditions:

Notwithstanding delivery and the passing of risk in the goods, the property in 
the goods shall not pass to the buyer until the seller
Flexipol Packaging Ltd. ("The Company") has received in cash or cleared funds 
payment in full of the price of the goods and all other goods agreed to be sold 
by the seller to the buyer for which payment is then due. Until such time as 
the property in the goods passes to the buyer, the buyer shall hold the goods 
as the seller's fiduciary agent and bailee and keep the goods separate from 
those of the buyer and third parties and properly stored protected and insured 
and identified as the seller's property but shall be entitled to resell or use 
the goods in the ordinary course of its business. Until such time as the 
property in the goods passes to the buyer the seller shall be entitled at any 
time

-Original Message-
From: ProFox  On Behalf Of Paul H. Tarver
Sent: 12 April 2018 14:19
To: profox@leafe.com
Subject: RE: Appending from a Cursor

Ok, so let me ask the $64,000 question: Which method is faster or better:
Append From DBF( or Insert Into as Gene used?

I have a similar project were I am issuing the same query to multiple SQL 
databases/servers and then using the Append From DBF( command to aggregate the 
results from each individual query into a large, single cursor to use for 
actual processing.

I'm traveling today or I'd test this myself, but I have limited access.
Figured I'd see if anyone else had already determined the best choice before I 
go poking around on my own.

Paul

-Original Message-
From: ProfoxTech [mailto:profoxtech-boun...@leafe.com] On Behalf Of Ted Roche
Sent: Thursday, April 12, 2018 6:18 AM
To: profoxt...@leafe.com
Subject: Re: Appending from a Cursor

On Wed, Apr 11, 2018 at 8:31 PM, Gene Wirchenko  wrote:
>
>  I am puzzled why (alimport) works for the SQL but not the append
from,
> but whatever.
>

I agree with you that it is un-intuitive that aliases work *almost* everywhere. 
It's one of those hundreds of FoxPro's "always been that way" things.

As others have said, APPEND FROM is ancient nearly-original XBase.
While it was updated occasionally for new file formats, the main purpose of the 
command is a low-level IMPORT (sibling command) from foreign formats and not as 
a cursor-manipulation command, so it's intended for reading files-on-disk and 
not cursors.


--
Ted Roche
Ted Roche & Associates, LLC
http://www.tedroche.com

[excessive quoting removed by server]

___
Post Messages to: ProFox@leafe.com
S

RE: Appending from a Cursor

2018-04-12 Thread Richard Kaye
As Ted would say, it depends on your environment. I doubt you will see any 
significant performance difference with a 100 row table. Big tables? Rotational 
vs SSD?

--

rk

-Original Message-
From: ProfoxTech  On Behalf Of Alan Bourke
Sent: Thursday, April 12, 2018 9:30 AM
To: profoxt...@leafe.com
Subject: Re: Appending from a Cursor

On Thu, 12 Apr 2018, at 2:18 PM, Paul H. Tarver wrote:
> Ok, so let me ask the $64,000 question: Which method is faster or better:
> Append From DBF( or Insert Into as Gene used? 

I remember seeing on fox.wikis.com that Insert-SQL can be up to 100x faster 
than Append from. Not sure how true that is.

-- 
  Alan Bourke
  alanpbourke (at) fastmail (dot) fm


___
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/dm5pr10mb124401228401f9e8597ef9ebd2...@dm5pr10mb1244.namprd10.prod.outlook.com
** 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.


Re: Appending from a Cursor

2018-04-12 Thread Alan Bourke
On Thu, 12 Apr 2018, at 2:18 PM, Paul H. Tarver wrote:
> Ok, so let me ask the $64,000 question: Which method is faster or better:
> Append From DBF( or Insert Into as Gene used? 

I remember seeing on fox.wikis.com that Insert-SQL can be up to 100x faster 
than Append from. Not sure how true that is.

-- 
  Alan Bourke
  alanpbourke (at) fastmail (dot) fm

___
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/1523539779.3075967.1335639552.21038...@webmail.messagingengine.com
** 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.


RE: Appending from a Cursor

2018-04-12 Thread Paul H. Tarver
Ok, so let me ask the $64,000 question: Which method is faster or better:
Append From DBF( or Insert Into as Gene used? 

I have a similar project were I am issuing the same query to multiple SQL
databases/servers and then using the Append From DBF( command to aggregate
the results from each individual query into a large, single cursor to use
for actual processing.

I'm traveling today or I'd test this myself, but I have limited access.
Figured I'd see if anyone else had already determined the best choice before
I go poking around on my own. 

Paul 

-Original Message-
From: ProfoxTech [mailto:profoxtech-boun...@leafe.com] On Behalf Of Ted
Roche
Sent: Thursday, April 12, 2018 6:18 AM
To: profoxt...@leafe.com
Subject: Re: Appending from a Cursor

On Wed, Apr 11, 2018 at 8:31 PM, Gene Wirchenko  wrote:
>
>  I am puzzled why (alimport) works for the SQL but not the append
from,
> but whatever.
>

I agree with you that it is un-intuitive that aliases work *almost*
everywhere. It's one of those hundreds of FoxPro's "always been that
way" things.

As others have said, APPEND FROM is ancient nearly-original XBase.
While it was updated occasionally for new file formats, the main
purpose of the command is a low-level IMPORT (sibling command) from
foreign formats and not as a cursor-manipulation command, so it's
intended for reading files-on-disk and not cursors.


-- 
Ted Roche
Ted Roche & Associates, LLC
http://www.tedroche.com

[excessive quoting removed by server]

___
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/08e401d3d260$f7849130$e68db390$@tpcqpc.com
** 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.


Re: Appending from a Cursor

2018-04-12 Thread Alan Bourke
On Thu, 12 Apr 2018, at 1:31 PM, Jean MAURICE wrote:
> Hi Gene,
> 
> 'append from' appends data from a file on the disk and a cursor is not a file 
> !

A cursor may or may not have a disk presence depending on various factors. 

But SQL is a a better way to do it.

insert into mytable (f1, f2, f3) select (f1, f2, f3) from mycursor



-- 
  Alan Bourke
  alanpbourke (at) fastmail (dot) fm

___
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/1523539264.3072881.1335625904.723d7...@webmail.messagingengine.com
** 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.


Re: Appending from a Cursor

2018-04-12 Thread Rafael Copquin
Append from dbf('yourcursor')

Rafael Copquin


El mié., 11 de abr. de 2018 15:02, Gene Wirchenko 
escribió:

> Hello:
>
>   I have some code where I am importing transactions.  I have a
> cursor for these transactions where I validate them.  After doing
> this, I want to add them to the transaction table.  I select the
> transaction alias and then do
>append from (alimport)
>
>   alimport is an alias variable.  It works for creating the cursor:
>SQLSEL * from cwkt;
>where .f.;
>into cursor (alimport) readwrite nofilter
> It works to select the cursor:
>   select (alimport)
>
>   So why does the append not work?  I get error 1 with the text
> "File 'c:\cbs2dev\cutlblas_import.dbf' does not exist."
>
>   I figured out how to do this using SQL, but I would still like
> to know why the append does not work.
>
> Sincerely,
>
> Gene Wirchenko
>
>
[excessive quoting removed by server]

___
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/cahm-jj3akdth5ni-wfsa8w2lyuux8364kqib7nuhktzapc_...@mail.gmail.com
** 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.

Re: Appending from a Cursor

2018-04-12 Thread Jean MAURICE

Hi Gene,

'append from' appends data from a file on the disk and a cursor is not a file !

Can you try this :
APPEND FROM (DBF(m.alimport))

The Foxil

___
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/8115740b-ec64-cb50-8810-f07643106...@wanadoo.fr
** 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.


Re: Appending from a Cursor

2018-04-12 Thread Ted Roche
On Wed, Apr 11, 2018 at 8:31 PM, Gene Wirchenko  wrote:
>
>  I am puzzled why (alimport) works for the SQL but not the append from,
> but whatever.
>

I agree with you that it is un-intuitive that aliases work *almost*
everywhere. It's one of those hundreds of FoxPro's "always been that
way" things.

As others have said, APPEND FROM is ancient nearly-original XBase.
While it was updated occasionally for new file formats, the main
purpose of the command is a low-level IMPORT (sibling command) from
foreign formats and not as a cursor-manipulation command, so it's
intended for reading files-on-disk and not cursors.


-- 
Ted Roche
Ted Roche & Associates, LLC
http://www.tedroche.com

___
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/CACW6n4vrZjBs2a=gkbq1x3jamgt+q--9ox-1yg7_zjvn2hf...@mail.gmail.com
** 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.


Re: Appending from a Cursor

2018-04-11 Thread Fernando D. Bozzo
... and one more thing to add to what Richard said about APPEND FROM:

When APPEND FROM was created, in dBase/CPM times (1979), SQL syntax did not
exist, so did not get implemented in any language, at least until 1986, far
later than dBase.



El jue., 12 abr. 2018 4:16, Richard Kaye  escribió:

> APPEND FROM is xBase. As others mentioned, it wants the physical file and
> a cursor is a temp file buried in your temp directory using sys(2015) to
> create the file name. The SQL SELECT doesn't care about the location of the
> physical file since you already have it open.
>
> --
>
> rk
>
> -Original Message-
> From: ProfoxTech  On Behalf Of Gene
> Wirchenko
> Sent: Wednesday, April 11, 2018 8:32 PM
> To: profoxt...@leafe.com
> Subject: RE: Appending from a Cursor
>
> At 11:10 2018-04-11, "John Weller"  wrote:
> >You could try
> >
> >APPEND FROM DBF(alimport)
>
>[whack object="hand" target="forehead"]  I have used it in the
> past, just not very often.  When I checked my code, I searched for
> "append from (" instead of just "append from".  Sometimes, 90% of the
> battle is knowing what to look for.
>
>   I ended up using
> 
> insert into (this.thiscode+"_cwkt") select * from (alimport)
> 
>
>   I am puzzled why (alimport) works for the SQL but not the
> append from, but whatever.
>
> [snip]
>
> Sincerely,
>
> Gene Wirchenko
>
>
[excessive quoting removed by server]

___
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/cagq_jukg5lx4n6bp_t8gqlywfrvu7j3xgip_jvdq7g-sepf...@mail.gmail.com
** 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.

RE: Appending from a Cursor

2018-04-11 Thread Richard Kaye
APPEND FROM is xBase. As others mentioned, it wants the physical file and a 
cursor is a temp file buried in your temp directory using sys(2015) to create 
the file name. The SQL SELECT doesn't care about the location of the physical 
file since you already have it open.

--

rk

-Original Message-
From: ProfoxTech  On Behalf Of Gene Wirchenko
Sent: Wednesday, April 11, 2018 8:32 PM
To: profoxt...@leafe.com
Subject: RE: Appending from a Cursor

At 11:10 2018-04-11, "John Weller"  wrote:
>You could try
>
>APPEND FROM DBF(alimport)

   [whack object="hand" target="forehead"]  I have used it in the 
past, just not very often.  When I checked my code, I searched for 
"append from (" instead of just "append from".  Sometimes, 90% of the 
battle is knowing what to look for.

  I ended up using

insert into (this.thiscode+"_cwkt") select * from (alimport)


  I am puzzled why (alimport) works for the SQL but not the 
append from, but whatever.

[snip]

Sincerely,

Gene Wirchenko 


___
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/dm5pr10mb1244cc5e101356a547d1a605d2...@dm5pr10mb1244.namprd10.prod.outlook.com
** 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.


RE: Appending from a Cursor

2018-04-11 Thread Gene Wirchenko

At 11:10 2018-04-11, "John Weller"  wrote:

You could try

APPEND FROM DBF(alimport)


  [whack object="hand" target="forehead"]  I have used it in the 
past, just not very often.  When I checked my code, I searched for 
"append from (" instead of just "append from".  Sometimes, 90% of the 
battle is knowing what to look for.


 I ended up using

insert into (this.thiscode+"_cwkt") select * from (alimport)


 I am puzzled why (alimport) works for the SQL but not the 
append from, but whatever.


[snip]

Sincerely,

Gene Wirchenko


___
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/f208e884721d2cfe717b654f87f35642@mtlp84
** 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.


RE: Appending from a Cursor

2018-04-11 Thread John Weller
You could try 

APPEND FROM DBF(alimport)

John

John Weller
01380 723235
07976 393631

> Hello:
> 
>   I have some code where I am importing transactions.  I have a
> cursor for these transactions where I validate them.  After doing
> this, I want to add them to the transaction table.  I select the
> transaction alias and then do
>append from (alimport)
> 
>   alimport is an alias variable.  It works for creating the cursor:
>SQLSEL * from cwkt;
>where .f.;
>into cursor (alimport) readwrite nofilter
> It works to select the cursor:
>   select (alimport)
> 
>   So why does the append not work?  I get error 1 with the text
> "File 'c:\cbs2dev\cutlblas_import.dbf' does not exist."
> 
>   I figured out how to do this using SQL, but I would still like
> to know why the append does not work.


___
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/001401d3d1c0$594ed160$0bec7420$@johnweller.co.uk
** 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.


Re: Appending from a Cursor

2018-04-11 Thread Thierry Nivelet
append from (dbf(alimport))

Append from expects a file

Thierry Nivelet
http://foxincloud.com/
Give your VFP app a second life in the cloud

> Le 11 avr. 2018 à 20:03, Gene Wirchenko  a écrit :
> 
> append from (alimport)


___
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/c6c715cb-8a81-4f0a-bf6f-e980fa6a7...@foxincloud.com
** 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.

Re: Appending from a Cursor

2013-09-04 Thread Gene Wirchenko

At 07:55 2013-09-03,Lew Schwartz  wrote:

Have to match? You can include constants, variables and data from other
cursors to make the columns match up. It's a code issue, not data.


 I got it working with append from dbf("cursorname").

 Using the SQL solution, I would have specify the columns 
because I am dealing with different structures.  Too much work, too 
prone to error.


[snip]

Sincerely,

Gene Wirchenko


___
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/
** 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.


Re: Appending from a Cursor

2013-09-03 Thread Lew Schwartz
Have to match? You can include constants, variables and data from other
cursors to make the columns match up. It's a code issue, not data.

-Lew Schwartz


On Mon, Aug 26, 2013 at 2:16 PM, Gene Wirchenko  wrote:

> At 06:45 2013-08-25, Lew Schwartz  wrote:
>
>> I don't think that will work all the time. A cursor may be a sql filtered,
>> behind the scenes view of a dbf. If you append from the actual dbf, you'll
>> lose the filter. The problem is mixing the legacy dml with sql; they don't
>> think of data in exactly the same way.
>>
>
>  Thank you for the warning, but it is not applicable in my case as I
> created the cursor with create cursor.
>
>
>  I believe, but don't have time to verify or remember, that a pure sql
>> statement will work. Something like:
>>
>> insert into targettable (field list);
>> select (sourcefield list) from sourcecursor
>>
>
>  Yes, it will work, but unfortunately, the two lists have to match.
>  Using append, you do not even need a list.
>
>
> [snip]
>
> Sincerely,
>
> Gene Wirchenko
>
>
> __**_
> Post Messages to: ProFox@leafe.com
> Subscription Maintenance: 
> http://mail.leafe.com/mailman/**listinfo/profox
> OT-free version of this list: http://mail.leafe.com/mailman/**
> listinfo/profoxtech 
> Searchable Archive: 
> http://leafe.com/archives/**search/profox
> This message: 
> http://leafe.com/archives/**byMID/profox/
> ** 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.
>


--- StripMime Report -- processed MIME parts ---
multipart/alternative
  text/plain (text body -- kept)
  text/html
---

___
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/cafuu78c0jdzauqmxfi8gy3pbusraumgeamozffrm-1rocav...@mail.gmail.com
** 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.


Re: Appending from a Cursor

2013-08-26 Thread Gene Wirchenko

At 06:45 2013-08-25, Lew Schwartz  wrote:

I don't think that will work all the time. A cursor may be a sql filtered,
behind the scenes view of a dbf. If you append from the actual dbf, you'll
lose the filter. The problem is mixing the legacy dml with sql; they don't
think of data in exactly the same way.


 Thank you for the warning, but it is not applicable in my case 
as I created the cursor with create cursor.



I believe, but don't have time to verify or remember, that a pure sql
statement will work. Something like:

insert into targettable (field list);
select (sourcefield list) from sourcecursor


 Yes, it will work, but unfortunately, the two lists have to 
match.  Using append, you do not even need a list.


[snip]

Sincerely,

Gene Wirchenko


___
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/
** 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.


Re: Appending from a Cursor

2013-08-25 Thread Man-wai Chang
You could always create a small program to test it. It will work, unless some
detail was not mentioned by the original question! There is always a workaround!

On Sun, Aug 25, 2013 at 9:45 PM, Lew Schwartz  wrote:
> I don't think that will work all the time. A cursor may be a sql filtered,
> behind the scenes view of a dbf. If you append from the actual dbf, you'll
> lose the filter. The problem is mixing the legacy dml with sql; they don't
> think of data in exactly the same way.

-- 
 .~. Might, Courage, Vision. SINCERITY!
/ v \ 64-bit Ubuntu 9.10 (Linux kernel 2.6.39.3)
/( _ )\ http://sites.google.com/site/changmw
^ ^ May the Force and farces be with you!

___
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/CAGv=mjbkfkmkct5tywcuxyngadzchyo9jmnd8k3s6jny1wa...@mail.gmail.com
** 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.


Re: Appending from a Cursor

2013-08-25 Thread Lew Schwartz
I don't think that will work all the time. A cursor may be a sql filtered,
behind the scenes view of a dbf. If you append from the actual dbf, you'll
lose the filter. The problem is mixing the legacy dml with sql; they don't
think of data in exactly the same way.

I believe, but don't have time to verify or remember, that a pure sql
statement will work. Something like:

insert into targettable (field list);
select (sourcefield list) from sourcecursor

-Lew Schwartz


On Tue, Aug 20, 2013 at 9:30 PM, Gene Wirchenko  wrote:

> At 15:29 2013-08-19, "Michael Oke, II"  wrote:
>
>> To append directly from a cursor use:  append from dbf('cCursorName')
>>
>
>  Thank you.  That did it.
>
> [snip]
>
> Sincerely,
>
> Gene Wirchenko
>
>
>
> __**_
> Post Messages to: ProFox@leafe.com
> Subscription Maintenance: 
> http://mail.leafe.com/mailman/**listinfo/profox
> OT-free version of this list: http://mail.leafe.com/mailman/**
> listinfo/profoxtech 
> Searchable Archive: 
> http://leafe.com/archives/**search/profox
> This message: 
> http://leafe.com/archives/**byMID/profox/
> ** 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.
>


--- StripMime Report -- processed MIME parts ---
multipart/alternative
  text/plain (text body -- kept)
  text/html
---

___
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/CAFuU78ceT2_b4B5Ky6HvN=ocwtm9ldnh7ga8avkjyfwhf3-...@mail.gmail.com
** 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.


Re: Appending from a Cursor

2013-08-20 Thread Gene Wirchenko

At 15:29 2013-08-19, "Michael Oke, II"  wrote:

To append directly from a cursor use:  append from dbf('cCursorName')


 Thank you.  That did it.

[snip]

Sincerely,

Gene Wirchenko


___
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/
** 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.


Re: Appending from a Cursor

2013-08-19 Thread Dan Covill

Gene,

  append from dbf("cursor1")

Dan


On 08/19/13 03:26 PM, Gene Wirchenko wrote:

Dear Vixens and Reynards:

  How do I append from a cursor?

  I am modifying a table structure, but I am renaming some columns.
I have set up three cursors (using create cursor) with the old, an
intermediate, and the new structure.  the problem is how to copy from
one cursor to another.

  I do something like:
   select cursor1
   append from (oldtablename)
   select cursor2
   append from _
What goes in the blank?  Simply the cursor name gets interpreted as a
filename.  How do I specify that it is a cursor?  "copy to" will
overwrite the structure.  I create cursors because I want to specify the
structure.

  Normally, this situation does not come up, because I am adding
columns.  In this case, I am renaming so I have to stage this a bit.

  Yes, I could use a temporary table, but I would rather not as the
code will not be running on my system.  (I like to tread as gently as I
can on others' systems.)

Sincerely,

Gene Wirchenko



[excessive quoting removed by server]

___
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/52129d31.8030...@san.rr.com
** 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.


Re: Appending from a Cursor

2013-08-19 Thread desmond . lloyd
Append from dbf('cursor name')?

Desmond
Sent via BlackBerry by AT&T

-Original Message-
From: Gene Wirchenko 
Sender: "ProFox" 
Date: Mon, 19 Aug 2013 15:26:32 
To: ProFox Email List
Reply-To: ProFox Email List 
Subject: Appending from a Cursor

Dear Vixens and Reynards:

  How do I append from a cursor?

  I am modifying a table structure, but I am renaming some 
columns.  I have set up three cursors (using create cursor) with the 
old, an intermediate, and the new structure.  the problem is how to 
copy from one cursor to another.

  I do something like:
   select cursor1
   append from (oldtablename)
   select cursor2
   append from _
What goes in the blank?  Simply the cursor name gets interpreted as a 
filename.  How do I specify that it is a cursor?  "copy to" will 
overwrite the structure.  I create cursors because I want to specify 
the structure.

  Normally, this situation does not come up, because I am adding 
columns.  In this case, I am renaming so I have to stage this a bit.

  Yes, I could use a temporary table, but I would rather not as 
the code will not be running on my system.  (I like to tread as 
gently as I can on others' systems.)

Sincerely,

Gene Wirchenko


___
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/
** 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.
___
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/1119365674-1376951435-cardhu_decombobulator_blackberry.rim.net-1306887027-@b15.c13.bise6.blackberry
** 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.


Re: Appending from a Cursor

2013-08-19 Thread Michael Oke, II
To append directly from a cursor use:  append from dbf('cCursorName')




Michael Oke, II
oke...@gmail.com
661-349-6221

On Aug 19, 2013, at 3:26 PM, Gene Wirchenko  wrote:

> Dear Vixens and Reynards:
> 
> How do I append from a cursor?
> 
> I am modifying a table structure, but I am renaming some columns.  I have 
> set up three cursors (using create cursor) with the old, an intermediate, and 
> the new structure.  the problem is how to copy from one cursor to another.
> 
> I do something like:
>  select cursor1
>  append from (oldtablename)
>  select cursor2
>  append from _
> What goes in the blank?  Simply the cursor name gets interpreted as a 
> filename.  How do I specify that it is a cursor?  "copy to" will overwrite 
> the structure.  I create cursors because I want to specify the structure.
> 
> Normally, this situation does not come up, because I am adding columns.  
> In this case, I am renaming so I have to stage this a bit.
> 
> Yes, I could use a temporary table, but I would rather not as the code 
> will not be running on my system.  (I like to tread as gently as I can on 
> others' systems.)
> 
> Sincerely,
> 
> Gene Wirchenko
> 
> 
[excessive quoting removed by server]

___
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/a9cef068-eced-4eba-9cf1-16b974ec6...@gmail.com
** 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.