Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 8 of 8 total
Thread Replicate TQuery
Sat, Jun 27 2009 7:41 PMPermanent Link

John
Hi.

I have a TQuery-component which contains a dataset. I would like to insert this dataset into a local table. Is there a easy method to do this, or do I
have to iterate through each record of the data and perform a "manual" insert-query?

Thanks,
John
Sun, Jun 28 2009 3:47 AMPermanent Link

Pat
John

>I have a TQuery-component which contains a dataset. I would like to insert this dataset into a local table.

What about

INSERT INTO MyLocalTable
SELECT ....
FROM ....

If local table does not exist yet

SELECT ....
INTO MyLocalTable
FROM ....


Pat
Sun, Jun 28 2009 7:28 AMPermanent Link

John
Hi Pat.

The problem is that the dataset is fetched from a remote datasource, so it is not possible for me to insert the data into the local table with a single
INSERT INTO statement.

Here is my code so far:

 s := TSession.Create;
 q := TQuery.Create;

 s.SessionName := 'RemoteDB';
 s.SessionType := stRemote;
 s.RemoteHost := 'xxx.xxx.xxx.xxx';
 s.RemoteCompression := 6;

 q.SessionName := s.SessionName;
 q.DatabaseName := 'TestDatabase';

 q.SQL.Add('SELECT * FROM Customers');
 q.Open;

// Here I need some code to insert the result into a local table.
Sun, Jun 28 2009 7:42 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

John


I think I've seen posts about this before and you have to carry out the operation in two stages:

1. create a table on the server
2. transfer the table over to the local PC

You should be able to find posts on just how to do it in the ngs

Roy Lambert
Sun, Jun 28 2009 7:48 AMPermanent Link

John
Hi Roy.

I have tried to search a bit on the newsgroup, but probably not enough. I will retry to search...

What do you mean by "transfer the table over to the local PC"? (That sounds interesting, and could be what I am looking for).

Thanks,
John



Roy Lambert wrote:

John


I think I've seen posts about this before and you have to carry out the operation in two stages:

1. create a table on the server
2. transfer the table over to the local PC

You should be able to find posts on just how to do it in the ngs

Roy Lambert
Sun, Jun 28 2009 9:00 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

John


Since I've never done it I'm not to sure Smiley I do remember this issue being raised a few times and I think it means some sort of FTP. With ElevateDB it would be simpler through STORES.

Just had a quick shuftie. This thread should be useful

Date: Thu, 23 Aug 2007 23:31:43 -0500
Path: news.elevatesoft.com
Lines: 13
Message-ID: <37214B55-32E8-4CB6-A17F-CF91715F3515@news.elevatesoft.com>
From: "Glynn Owen" <glynnMowenREMOVE@hotmail.comDELETE>
Subject: Remote batch append
Newsgroups: elevatesoft.public.dbisam.clientserver
User-Agent: XanaNews/1.17.6.6
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1

Roy Lambert [Team Elevate]
Sun, Jun 28 2009 9:18 AMPermanent Link

"Robert"

"John" <eydunl@post.olivant.fo> wrote in message
news:CBA30C97-F5C3-41A6-AD2A-AD0FAA8C246D@news.elevatesoft.com...
> Hi Roy.
>
> I have tried to search a bit on the newsgroup, but probably not enough. I
> will retry to search...
>
> What do you mean by "transfer the table over to the local PC"?

You move it as a stream.

Robert

(That sounds interesting, and could be what I am looking for).
>
> Thanks,
> John
>
>
>
> Roy Lambert wrote:
>
> John
>
>
> I think I've seen posts about this before and you have to carry out the
> operation in two stages:
>
> 1. create a table on the server
> 2. transfer the table over to the local PC
>
> You should be able to find posts on just how to do it in the ngs
>
> Roy Lambert
>

Sun, Jun 28 2009 4:38 PMPermanent Link

John
Thanks! LoadFromStream and SaveToStream are perfect.
Image