Unfortunately, you'll probably have to do this entirely through file
manipulation. The ODBC Microsoft Text Driver is great for reading and
sorting data, but only supports the SELECT and INSERT statements, not
UPDATEs, IIRC.
You do recall correctly but you've not considered (out loud <g>) the
ability to CREATE and DROP tables.
For example, consider this three-row table:
CREATE TABLE db#txt (
key_col INTEGER,
data_col INTEGER
)
;
INSERT INTO db#txt (key_col, data_col)
VALUES (1, 1)
;
INSERT INTO db#txt (key_col, data_col)
VALUES (2, 2)
;
INSERT INTO db#txt (key_col, data_col)
VALUES (3, 3)
;
Trying to UPDATE directly (as you point out) does not work e.g. this:
UPDATE db#txt
SET data_col = 22
WHERE key_col = 2
;
generates the failure message, "Deleting data in a linked table is not
supported by this ISAM."
Why did the message mention "Deleting"? Well, an update is logically
equivalent to a delete and an insert (which is why, incidentally, in
SQL Server a trigger has logical tables named 'updated' and 'inserted'
but not 'deleted'). As the above message suggests, a direct DELETE
will not work either.
However, we do have to ability to CREATE and DROP new tables,
therefore a few extra steps will give the desired results: create a
new copy table and populate it with only the data to be retained plus
the new (updated) data; drop the original table; recreate the original
table and populate the newly-created original table with data from the
copy table; drop the copy table. In SQL:
SELECT DT1.key_col, DT1.data_col
INTO db_copy#txt
FROM
(
SELECT key_col, data_col
FROM db#txt
WHERE key_col <> 2
UNION ALL
SELECT key_col, 22
FROM db#txt
WHERE key_col = 2
) AS DT1
;
DROP TABLE db#txt
;
SELECT key_col, data_col
INTO db#txt
FROM db_copy#txt
;
DROP TABLE db_copy#txt
;
Jamie.
--