khsaunderson
Technical User
In the example below the first 3 columns are the unique identifier, and the 4th column contains the data. The TUNCODE is an auto incrementing field (hence it is commented out).
However, every time I run the insert I get an error saying "SQL0803 - Duplicate key value specified." But I have checked and the TEMP_TABLE definitely doesn't contain any duplicates as found in the MAIN_TABLE. So I am beginning to think that it is picking up on the fact that the TUNTYPE and TUNCONT will be duplicated. But since the TUNCODE will be auto incremented, it shouldn't be duplicated. Eg,
So I'm very confused...
Any help would be gratefully received.
Code:
INSERT INTO MAIN_TABLE
(--TUNCODE,
TUNTYPE,
TUNCONT,
TUNTITLE)
SELECT
'1', --TUNTYPE,
'0000000', --TUNCONT,
PHYSICAL_ISRC --TUNTITLE
FROM TEMP_TABLE;
However, every time I run the insert I get an error saying "SQL0803 - Duplicate key value specified." But I have checked and the TEMP_TABLE definitely doesn't contain any duplicates as found in the MAIN_TABLE. So I am beginning to think that it is picking up on the fact that the TUNTYPE and TUNCONT will be duplicated. But since the TUNCODE will be auto incremented, it shouldn't be duplicated. Eg,
Code:
TUNCODE TUNTYPE TUNCONT
000012 1 000000
000013 1 000000
000014 1 000000
So I'm very confused...
Any help would be gratefully received.