Ok. I changed it to:
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 ProjectStatus..ProjectInfo2 (ProjectName)
VALUES (ProjectName)
RETURN
But its still not working. This is the error I am getting:
Server: Msg 128, Level 15, State 1, Procedure Update_DB, Line 13
The name 'ProjectName' is not permitted in this context. Only constants, expressions, or variables allowed here. Column names are not permitted.
What can I do? The bolded part is the problem.
*******(*)*******
|