Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trigger Help!?

Status
Not open for further replies.

Darrick

Technical User
Aug 28, 2001
77
US
What is wrong with my code below?

It continues to throw the following error:

Server: Msg 207, Level 16, State 3, Procedure InsertProbationStopDate, Line 8
Invalid column name 'Emp_Probation'.


-- Trigger valid for multirow and single row inserts
-- and optimal for single row inserts.
CREATE TRIGGER InsertProbationStopDate
ON [dbo].[Emp_Probation]
AFTER INSERT AS
IF @@ROWCOUNT = 1
BEGIN
UPDATE Emp_Probation
SET ProbationStopDate = (DateAdd(Day, Emp_Probation.LengthOfProb, Emp_Probation.ProbationStartDate))
FROM inserted
WHERE (Emp_Probation.EmployeeID = inserted.EmployeeID) AND
(Emp_Probation.ProbationStartDate = inserted.Emp_Probation)AND
(Emp_Probation.ReasonForProb = inserted.ReasonForProb)
END
ELSE
Print 'Else'



Thanks in advance for any help!

Darrick

 
reply would guess the problem is a typo with this line
Code:
 (Emp_Probation.ProbationStartDate = inserted.Emp_Probation)AND
should it be
Code:
 (Emp_Probation.ProbationStartDate = inserted.ProbationStartDate )AND

"I'm living so far beyond my income that we may almost be said to be living apart
 
Ahh... Yeah that would be it.

God loves stupid mistakes also!

Thanks again,

Darrick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top