Hello! On Thursday 08 April 2010 01:06:25 P Kishor wrote: > > Probably the only way to do that is > > > > REPLACE INTO t (id, foo, bar, ...) > > SELECT 649, foo, bar, ... > > WHERE id = 651 > > > > I get a "Error: constraint failed". I have no constraint other than > INTEGER PRIMARY KEY on id.
This work right: sqlite> create temp table test(id INTEGER PRIMARY KEY,a); sqlite> insert into test (a) values (10); sqlite> insert into test (a) values (11); sqlite> select * from test; 1|10 2|11 sqlite> replace into test select 1,a from test where id=2; sqlite> select * from test; 1|11 2|11 So you have some constraints or unique indicies on your table. P.S. For more than single record: CREATE TEMP TABLE temp_t AS SELECT * FROM t WHERE id = 651; UPDATE temp_t SET id=649; -- may be id=id-2 for set of records INSERT INTO t SELECT * FROM temp_t; Best regards, Alexey Pechnikov. http://pechnikov.tel/ _______________________________________________ sqlite-users mailing list [email protected] http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

