Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Sql way of doing append
Message
From
26/02/2000 13:29:36
 
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00338025
Message ID:
00338052
Views:
13
Hi Cyril

> select whatever into cursor temp
> thedbf = dbf()
> select bigtable
> append from (thedbf)
>
>The question is: Instead of the append from, is there a more sql way of doing the above?

The following is more SQL'ish. This assumes temp has same structure as bigtable, and the pk constraints aren't being violated:
SELECT temp
SCAN
  SCATTER MEMVAR
  INSERT INTO bigtable FROM MEMVAR
ENDSCAN
If field names are different, look at the INSERT - SQL statement--you can INSERT from array, and you can explicitly set the values.

I don't know that it would be faster (I haven't benchmarked it or anything) but might be easier to read, if that is what you are looking for.

AFAIK, there is nothing wrong with the way you are doing it. Switching just to be more SQL isn't necessarily a good idea.

Now in more SQL oriented environments (like SQL Server for example) you can have something like this:
INSERT bigTable SELECT * FROM temp
VFP SQL syntax doesn't support this SELECT style AFAIK, so a loop of some sort is necessary.

HTH,
Bill
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform