Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 7 of 7 total
Thread Querying into a memory table - howto?
Mon, Mar 20 2006 1:46 PMPermanent Link

John Rock
I have a memory table which is already created, active and named as ORD_DETAILMEM;

I have an identical table on the disk which is named as : ORD_DETAIL;

What I want to do is insert some records from the disk based table into the memory table. What is the best way to do it? (I can
copy records one by one from the disk based table into the memory table, but there must be a simpler way I guess).

The following SQL codes don't not work for the above mentioned purpose:
INSERT INTO "\MEMORY\ORD_DETAILMEM"
SELECT * FROM ORD_DETAIL;

SELECT *
INTO "\MEMORY\ORD_DETAILMEM"
FROM ORD_DETAIL;

In general, my question is : "How can I use already created memory tables in SQL queries".

Thanks in advance;

John
Mon, Mar 20 2006 2:18 PMPermanent Link

John Rock
I forgot to mention:

The memory table is defined in a datamodule and it is used in many forms in the application.
Mon, Mar 20 2006 3:07 PMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

John


I don't have any problems with it. Memory and disk tables should work identically

Roy Lambert
Tue, Mar 21 2006 11:39 AMPermanent Link

John
Hi Roy;

I know that memory and disk based tables work the same way.
My question is related to an already created memory table.

Let's say that I have a memory table in a datamodule and I can access it like "Datamodule1.TBL_MEM".
This table is active and contains data.

How can I use this table in an SQL query? What is the format?
SELECT * FROM "\MEMORY\Datamodule1.TBL_MEM" or
SELECT * FROM "\MEMORY\TBL_MEM"

Neither of the above seems to work.

John
Tue, Mar 21 2006 11:59 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

John


OK first memory tables are accessible to all sessions WITHIN a process so if the memory table is outside of your process then you can't access it at all (you can try this by creating a memory table in DBSys, starting another copy of DBSys and you won't be able to access it, but you can in the one that created it).

Syntax is simply "memory\table" - I use quotes but I don't think they're strictly necessary.

Next - just because a TDBISAMTable component is on a datamodule doesn't mean there's a table there what you seem to be saying is that you want to address the memory table in sql using the TDBISAMTable component name. What you actually need to do is address it by the name that the component refers to. Check what the TableName property is for Datamodule1.TBL_MEM and that's what you should use.

If I've totally misunderstood what you're saying and doing sorry.

Roy Lambert
Tue, Mar 21 2006 2:50 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

John,

<< The following SQL codes don't not work for the above mentioned purpose:
INSERT INTO "\MEMORY\ORD_DETAILMEM"
SELECT * FROM ORD_DETAIL; >>

That is the correct method to use.  What is occurring when you try that - is
there an error or do the records simply not get copied ?

--
Tim Young
Elevate Software
www.elevatesoft.com

Thu, Mar 23 2006 2:37 PMPermanent Link

John Rock
Yes, it works.

Sorry for the previous posts. There was a mistake on my part.

John

Image