Stephen Blake wrote:
This is fine, but I'd like to use something smaller, i.e. the rowid. I
understand that if I .dump the tables, the rowid's will change. Is it
possible to force them to be the same, for example, by doing something
like this (forgive errors, I hope you get the idea):
SELECT 'INSERT INTO t1 (rowid, sha1) VALUES (' ||
rowid || ',' || sha1 || ')' FROM t1;
1. An INTEGER PRIMARY KEY column is really just an alias for
the rowid. So if you make your primary key an INTEGER PRIMARY
key, your rowid will be preserved by .dump.
2. You can also do it using the select above, with some minor
changes:
SELECT 'INSERT INTO t1(rowid,sha1) VALUES(' || rowid || ','
|| quote(sha1) || ');' FROM t1;
^^^^^^ ^ ^
The (undocumented) quote function puts the string inside single-quotes
if it needs it. And you need a semicolon at the end of the statement.
--
D. Richard Hipp -- [EMAIL PROTECTED] -- 704.948.4565
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]