I have two tables
+---------------------------------+
| Table A |
+----------+-----------+----+-----+
| Part No | Serial No | PO | DO |
+----------+-----------+----+-----+
| 1AB1009 | GR7764 | ST | OND |
| 1AB1009 | GR7765 | ST | OND |
+----------+-----------+----+-----+
+-----------+
| Table B |
+-----------+
| Serial No |
+-----------+
| GR7764 |
| GR7765 |
+-----------+
Table B have only one column with unique serial no’s, am matching the serial no in both tables and updating the values if there is a match…my query is running nice for this but I have a scenario like first I upload a csv file to Table B then I will match…but Table A may not have some serial no’s, so if there is no match it should prompt me to go the add page to add the records to Table A and then perform update query.
This is my query
update TableA
set Mat_No ='"+ Mat_No+"',WO_No='"+WO_No+"',Code = '"+Code+"',
Desc = '"+Desc+"',Center='"+Center+"',Date='"+Date+"',Remarks='"+Remarks+"'
where SerialNo in(select A.SerialNo
from Table A, Table B
where B.SerialNo = A.SerialNo and A.Status = 'IN');
First I will upload a csv file to table B then I fill all the details like MatNo etc then update if the csv file is having the serial no which are not in Table A then it should prompt me with all the serial no’s no match in table A…. don’t know how to do this?? Please help me out…
Here are the steps you can do:
Now create an instead of Update trigger on tableA to warn about SNOs missing in tableA when trying to insert from front end app
Test if the trigger fires when the Sno are missing
Finally clean up the code