Dear sirs!
I try to store table data in a file to transfer it to another database using "SaveToXML" into a memory stream, compress it and store it to a file. This works as long as table data is not too big, but now I had to store more than 1 million rows and so I get out of memory.
Is there any way (cursor or so) to divide the data into several peaces, so that I will not run out of memory?
Here is an example: (ms1 is my memory stream)
qryDaten.Close;
qryDaten.FetchRows := 500;
qryDaten.SQL.Text := 'SELECT * FROM ' + tablename;
qryDaten.Open;
ms1.Clear;
qryDaten.SaveToXML(ms1);
ms1.Position := 0;
Compress1.CompressStreamToArchive(filename,ms1,tablename + '.DAT',coLH5);
Thx in advance
Moehre
How to store big table data?
You should modify your query:
Assing values for parameters and execute the query to get a part of data.
Code: Select all
SELECT * FROM Table1
WHERE Id BETWEEN :Id1 AND :Id2
Assing values for parameters and execute the query to get a part of data.
Hi Plash!
Unfortunately that won't work for me, because the customer can store any table he wants; so I don't know the key fields or their value range to do so.
Is there any way to use the rowid? In Oracle I could select with "ROWNUM < xxx ORDER BY ROWID", but how to do so using MS SQL Server, Access or DB2 ??
Thx
Moehre
Unfortunately that won't work for me, because the customer can store any table he wants; so I don't know the key fields or their value range to do so.
Is there any way to use the rowid? In Oracle I could select with "ROWNUM < xxx ORDER BY ROWID", but how to do so using MS SQL Server, Access or DB2 ??
Thx
Moehre