Long time looker, first time poster. This is way over my head. I have spent 3 days looking and trying to solve this problem. Your help is greatly appreciated.
I am trying to populate an AS400 database with 11 fields. I am receiving a "duplicate entries" error. I would expect this, but I need a way to work around it. For instance, a single part number may have up to 5 or 6 different price codes depending on which customer is making the purchase. So, it is necessary to have the part number listed multiple times, but with different pricing codes. Here's what I have been trying so far (remember I'm a SQL newbie). INSERT INTO WEBPRDDT1.WBMSCUR (SPPTNO, SPDESC, SPLDTM, SPCATG, SPPRC1, SPPRC2, SPPRC3, SPPMBQ, SPDATE, SPATA, SPUSER) VALUES ('3408320018','PLASTIC SCREW','035','','0.25','0.23','0.18','0','50812','UAE','DWD') WHERE SPATA='UAE';
If I don't use the "WHERE", I get the "duplicate entries" error. If I DO use the "Where" statement, it tells me that WHERE was not expected. What am I doing wrong?
I want to be able to look at the parts in the database and, if a few key fields are the same (and the pricing code for that part already exists in the database), then update with the changes. If the part number is the same, but the pricing code field does NOT exist, I want it to insert a new entry, and copy all the matching information, with the new pricing code. How can I do this?
I am trying to populate an AS400 database with 11 fields. I am receiving a "duplicate entries" error. I would expect this, but I need a way to work around it. For instance, a single part number may have up to 5 or 6 different price codes depending on which customer is making the purchase. So, it is necessary to have the part number listed multiple times, but with different pricing codes. Here's what I have been trying so far (remember I'm a SQL newbie). INSERT INTO WEBPRDDT1.WBMSCUR (SPPTNO, SPDESC, SPLDTM, SPCATG, SPPRC1, SPPRC2, SPPRC3, SPPMBQ, SPDATE, SPATA, SPUSER) VALUES ('3408320018','PLASTIC SCREW','035','','0.25','0.23','0.18','0','50812','UAE','DWD') WHERE SPATA='UAE';
If I don't use the "WHERE", I get the "duplicate entries" error. If I DO use the "Where" statement, it tells me that WHERE was not expected. What am I doing wrong?
I want to be able to look at the parts in the database and, if a few key fields are the same (and the pricing code for that part already exists in the database), then update with the changes. If the part number is the same, but the pricing code field does NOT exist, I want it to insert a new entry, and copy all the matching information, with the new pricing code. How can I do this?