Subject Re: SQL save to ignores database setting
From Mervyn Bick <invalid@invalid.invalid>
Date Thu, 19 Apr 2018 11:42:34 +0200
Newsgroups dbase.getting-started

On 2018-04-19 10:55 AM, Pieter van Heerden wrote:
> I have tried the following code to extract data and to save it to a different table for the sake of saving code lines.
>
> set database to sapwat
> select DISTINCT stationid, wstation, countryid, type from importtemp save to wstemp
>
> The SQL statement selects the right table in the database and does the expected extraction, but the result is saved not to the database, but to the working directory.  I have tried the following:
>
> set database to sapwat
> select DISTINCT stationid, wstation, countryid, type from importtemp save to :sapwat:wstemp
>
> But the result is still the same, the database statement/indicator is ignored.
>
> Is something wrong in the code?  How does one manage this problem?
>

What version of dBASE are you using?

In dBASE 11.3 the following code, which is similar but not exactly like
your code, works as expected.

open database dbasesamples
set database to dbasesamples
select name from fish save to fishname


This was run from a little program in my working directory.  In the
Navigator the Tables tab displayed the .dbf files in the working directory.

After the program was executed the Navigator showed the working
directory in the Programs tab but the Tables tab showed the dbasesamples
tables.

Running the program a second time brought the message "database already
open".  Ignoring the message then brought the message "fishnames already
exists.  Overwrite "  with the usual Yes/No buttons.

Mervyn.