alfranco17
New member
- Local time
- Today, 14:06
- Joined
- Oct 3, 2012
- Messages
- 3
Hi.
I'm trying to run an append query to copy from a table to its twin.
It works fine the first time I run it, when t_transactions is empty, but fails when it has even a single record and I get a "key violations error" .
I am not including the primary key on the query, and believe it should be automatically assigned (it is an autonumber).
INSERT INTO t_transactions ( id_trans_type, id_product, f_quantity, id_locación, effdate, actdate, id_user, id_po, id_so, id_inv, f_comments )
SELECT 'TRANSFER' AS f_trans_type, temp_t_transactions.id_product, temp_t_transactions.f_quantity, temp_t_transactions.id_locación, temp_t_transactions.effdate, Now() AS actdate, 'AFRANCO' AS id_user, temp_t_transactions.id_po, temp_t_transactions.id_so, temp_t_transactions.id_inv, temp_t_transactions.f_comments
FROM temp_t_transactions;
Any help will be greatly appreciated, as I have no idea what could be wrong. If I type in the data, it works. It works the first time also, but when there are records in the destination, there is always a key conflict.
Thanks.
Armando.
INSERT INTO t_transactions ( id_trans_type, id_product, f_quantity, id_locación, effdate, actdate, id_user, id_po, id_so, id_inv, f_comments )
SELECT 'TRANSFER' AS f_trans_type, temp_t_transactions.id_product, temp_t_transactions.f_quantity, temp_t_transactions.id_locación, temp_t_transactions.effdate, Now() AS actdate, 'AFRANCO' AS id_user, temp_t_transactions.id_po, temp_t_transactions.id_so, temp_t_transactions.id_inv, temp_t_transactions.f_comments
FROM temp_t_transactions;
Any help will be greatly appreciated, as I have no idea what could be wrong. If I type in the data, it works. It works the first time also, but when there are records in the destination, there is always a key conflict.
Thanks.
Armando.