03-13-14, 08:42 #1Registered User
- Join Date
- Mar 2014
Unanswered: How to update cust_id from Customer table to order table Cust_id field while insert
I have two tables 1. Customer_details and 2. Order_details.
** 1.Customer_details table -->fields--> Cust_Id(Primary Key) and Customer_Name, 2.Order_details table --> fields-- Ord_Id(Primary Key), Cust_id, (There is no field for Customer name in Order_details table). I am trying to insert customer name to order_details by CSV file through application code. When insert customer name to order_details table it should check the corresponding Customer name- Custid from Customer_details table and insert the relevant customer name Custid to order_details table. Need to implement this in Database level not in application coding level. Searching lot in this and cant figure out. If possible need to implement with trigger. Kindly help with the code.
03-13-14, 13:52 #2Resident Curmudgeon
Provided Answers: 54
- Join Date
- Feb 2004
- In front of the computer
Assuming that you need this for query purposes, I would recommend using a JOIN instead of a trigger.
-PatPIn theory, theory and practice are identical. In practice, theory and practice are unrelated.