sql - Very Simple Insert From Select Not Working? -
all did remake table , add null constrants , default values on columns:
original table structure (now renamed):
create table "cartweights_old" ( entrytime datetime, employee text, plugs numeric, id integer primary key, po numeric, fuser integer, reman integer, oem integer, digitek integer, lexmark integer, pdw integer, trash integer, cart text, "voided" bool not null default 0 )
the new table:
create table cartweights ( entrytime datetime, employee text, plugs numeric not null default 0, id integer primary key, po numeric, fuser integer not null default 0, reman integer not null default 0, oem integer not null default 0, digitek integer not null default 0, lexmark integer not null default 0, pdw integer not null default 0, trash integer not null default 0, cart text, "voided" bool not null default 0 )
then when try run:
insert cartweights select * cartweights_old
the cartweights table not updated info. sqlite not give me errors.
your problem de sequence generator id. try not inserting pk in destination table:
insert "cartweights" "entrytime","employee","plugs","po","fuser","reman","oem","digitek","lexmark", "pdw","trash","cart","voided" select "entrytime","employee","plugs","po","fuser","reman","oem","digitek","lexmark", "pdw","trash","cart","voided" "cartweights_old"
Comments
Post a Comment