Hello,
I got some help with the update when I was working on that part, but now I need to add some more to the trigger and I've running into a lot of problems. Most of them I've fixed, but now I'm stuck. If anyone can help me I would be very thankful.
Here it is:
ALTER TRIGGER [Update_DB] ON [dbo].[ProjectInfo]
FOR INSERT, UPDATE
AS
If UPDATE(ProjectName)
IF EXISTS (SELECT * FROM INSERTED)
UPDATE ProjectStatus..ProjectInfo2
SET ProjectName = i.ProjectName
FROM DELETED d, ProjectStatus..ProjectInfo2 t, INSERTED i
WHERE d.ProjectName = t.ProjectName
ELSE
INSERT INTO ProjectStatus..ProjectInfo2
VALUES ('BidNum', 'ProjectName', 'ProjectLead', 'WklyTotalHrs', 'TotalHrs', 'EmpNum')
Ok. I'm trying to update a record in Table ProjectInfo2 in the ProjectStatus database if an update occurs to Table ProjectInfo in the dbTimeSheet database. Also, it has to check to see if the record exists (mainly the ProjectName) in Table ProjectInfo2 if it does then update, else insert. I am not receiving any errors, but when I there is an update, it does not do the insert if it does not exist.
'BidNum', 'ProjectName'...etc are actually column names in the ProjectInfo2 Table. I am so lost.
*******(*)*******