Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 10 of 10 total
Thread Export a subset of records to csv
Mon, Jul 23 2007 10:12 AMPermanent Link

Peter Thorne
I thought I would take a punt on the following ...

procedure TdmExtrapolate.ExportModel;
begin
 with qryImpEx do
 try
   SQL.Add('EXPORT TABLE (SELECT * FROM Models WHERE model_id = '
                          + QuotedStr(tblModelsmodel_name.AsString))');
   SQL.Add('TO ' + QuotedStr(TempLocation + 'Model.csv'));
   Prepare;
   ExecSQL;
 finally
   SQL.Clear
 end
end;

but without success!

Any suggestions?

Thanks

Peter
Mon, Jul 23 2007 3:35 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Peter,

<< I thought I would take a punt on the following ... >>

You can't use derived tables (SELECT) with the IMPORT or EXPORT statements.

--
Tim Young
Elevate Software
www.elevatesoft.com

Tue, Jul 24 2007 3:35 AMPermanent Link

Peter Thorne
"Tim Young [Elevate Software]" <timyoung@elevatesoft.com> wrote:

You can't use derived tables (SELECT) with the IMPORT or EXPORT statements.

Tim - is there an easy way to export a subset of records though? We need to be able to transfer bits of our database amongst users (who won't want the whole thing). In the DBISAM version we just created some temporary tables, zipped
them up programmatically and used an import procedure to unzip and import on the receivers machine. I am not quite sure how I can achieve this functionality with EDB. Presumably it won't take kindly to overwriting individual table files in
the data directory? Apologies for what is probably a bit of a dumb question ...
Tue, Jul 24 2007 3:48 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Peter


Check out the CREATE AS functionality. Similar to SELECT INTO but different Smiley

Roy Lambert
Tue, Jul 24 2007 5:51 AMPermanent Link

Peter Thorne
Roy Lambert <roy.lambert@skynet.co.uk> wrote:

Check out the CREATE AS functionality. Similar to SELECT INTO but different Smiley

Thanks Roy. I think I get your drift here. Looks like it could be an option ...
Tue, Jul 24 2007 4:10 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Peter,

<< Tim - is there an easy way to export a subset of records though? We need
to be able to transfer bits of our database amongst users (who won't want
the whole thing). In the DBISAM version we just created some temporary
tables, zipped them up programmatically and used an import procedure to
unzip and import on the receivers machine. I am not quite sure how I can
achieve this functionality with EDB. Presumably it won't take kindly to
overwriting individual table files in the data directory? Apologies for what
is probably a bit of a dumb question ... >>

As Roy said, CREATE AS will do what you want, however you cannot use a
temporary table for the import/export as of yet, so I will have to change
that in an upcoming build so that you don't have to create a permanent table
for such an operation.

--
Tim Young
Elevate Software
www.elevatesoft.com

Wed, Jul 25 2007 3:41 AMPermanent Link

Peter Thorne
"Tim Young [Elevate Software]" <timyoung@elevatesoft.com> wrote:

<< As Roy said, CREATE AS will do what you want, however you cannot use a
temporary table for the import/export as of yet, so I will have to change
that in an upcoming build so that you don't have to create a permanent table
for such an operation. >>

Thanks Tim. I've built a solution based on this and it seems to work fine. Its more involved than DBISAM but I can see that it is likely to be more robust and "manageable" in the end.

--
Tim Young
Elevate Software
www.elevatesoft.com

Wed, Jul 25 2007 4:13 AMPermanent Link

Chris Erdal
"Tim Young [Elevate Software]" <timyoung@elevatesoft.com> wrote in
news:37256EE9-CE6E-44E2-9FDE-694A4B620B72@news.elevatesoft.com:

> however you cannot use a
> temporary table for the import/export as of yet...
>

Tim,

 Is it/would it be possible to EXPORT from a VIEW ? If so, that might be a
simpler way of doing arbitrary EXPORTS.

I ask because IIRC SQL Server allowed pretty well everything you could do
with a TABLE for VIEWs.

--
Chris
(XP-Pro + Delphi 7 Architect + DBISAM 4.25 build 4 + EDB 1.04 build 3)

Wed, Jul 25 2007 3:57 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Chris,

<< Is it/would it be possible to EXPORT from a VIEW ? If so, that might be a
simpler way of doing arbitrary EXPORTS. >>

Actually, it's the same situation - I will, however, add view support for
IMPORT/EXPORT also since the tables/views are virtualized anyways.

--
Tim Young
Elevate Software
www.elevatesoft.com

Thu, Jul 26 2007 5:08 AMPermanent Link

Chris Erdal
"Tim Young [Elevate Software]" <timyoung@elevatesoft.com> wrote in
news:49CB26FF-6562-4833-8909-C9812095CC95@news.elevatesoft.com:

> I will, however, add view support
> for IMPORT/EXPORT also since the tables/views are virtualized anyways.
>

Thanks.

--
Chris
(XP-Pro + Delphi 7 Architect + DBISAM 4.25 build 4 + EDB 1.04 build 3)

Image