Create Complex Trigers need help
-
I have three tables 1) AssignProjectUser(ProjectID,UserID) 2) Task(ID,ProjectID) 3) AssingnTaskUser(UserID,TaskID) I will create Trigers that after inserting a assignProjectUser I will select all the task who have the ProjectID inserted in AssignProjectUser and insert list of AssignTaskUser that have the userID same assignProjectUser and TaskID that i have selected Exemple: suppose that I have TASK: 1 1 2 1 3 2 when I insert a assignProjectUser (1,15) the number of task for this Project is 1 and 2 so the trigers will add (1,15) (2,15) I hope that you understand me and really need help as soon thanks DADAX
-
I have three tables 1) AssignProjectUser(ProjectID,UserID) 2) Task(ID,ProjectID) 3) AssingnTaskUser(UserID,TaskID) I will create Trigers that after inserting a assignProjectUser I will select all the task who have the ProjectID inserted in AssignProjectUser and insert list of AssignTaskUser that have the userID same assignProjectUser and TaskID that i have selected Exemple: suppose that I have TASK: 1 1 2 1 3 2 when I insert a assignProjectUser (1,15) the number of task for this Project is 1 and 2 so the trigers will add (1,15) (2,15) I hope that you understand me and really need help as soon thanks DADAX
CREATE TRIGGER trg_AssignProjectUser ON [dbo].[AssignProjectUser]
FOR INSERT
ASINSERT INTO AssignTaskUser (UserID,TaskID)
SELECT inserted.userid,task.id
FROM task INNER JOIN inserted on task.projectid = inserted.projectid---------- There go my people. I must find out where they are going so I can lead them. - Alexander Ledru-Rollin
-
CREATE TRIGGER trg_AssignProjectUser ON [dbo].[AssignProjectUser]
FOR INSERT
ASINSERT INTO AssignTaskUser (UserID,TaskID)
SELECT inserted.userid,task.id
FROM task INNER JOIN inserted on task.projectid = inserted.projectid---------- There go my people. I must find out where they are going so I can lead them. - Alexander Ledru-Rollin