0 pts.
 Triggers in sql server 2005
hi Experts, I have created a table called MyEmployees with ManagerID,ContactID,etc.,.. fields. Also i created another table ManagerAndContact with Only ManagerID and ContactID as fields. Now what i need is, whenever am inserting a new row in MyEmployees table, the corresponding ManagerId and ContactId should be inserted into the second table - ManagerAndContact using trigger. Note: the id's are not in ascending or descending order. The data to the MyEmployees are fetched from a text file with random values for id's(managerid,contactid) Ex: 1029, 1019, 1044, 1024. ......

Software/Hardware used:
ASKED: October 9, 2007  2:36 AM
UPDATED: December 2, 2007  11:24 AM

Answer Wiki:
Yes. You can do this using the insert trigger. Select the values from the inserted table that is available in the insert trigger and insert them in the ManageAndContact table.
Last Wiki Answer Submitted:  October 24, 2007  4:22 pm  by  Harshini   0 pts.
All Answer Wiki Contributors:  Harshini   0 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

I would have to ask, what is the second table used for? It appears to be a duplicate of the columns in the MyEmployees table. I would say that a database design review needs to be done to make sure that this actually needs to be done this way, and most probably remove the duplicate table.

 64,520 pts.