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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Syntax Error in Update Trigger 1

Status
Not open for further replies.

barrylowe

Programmer
Nov 6, 2001
188
0
0
GB
I am trying to write a trigger in SQL Server 2000 that will update the LastModifiedOn filed in my table every time the record is updated.

I have used the following code but it is producing a syntax error:

CREATE TRIGGER [UpdateAssessments] ON [dbo].[Assessments]
FOR UPDATE
AS

BEGIN

UPDATE [dbo].[Assessments]
SET [dbo].[Assessments].[LastModifiedOn] = GETDATE()
FROM inserted
WHERE inserted.[AssessmentID] = [dbo].[Assessments].[AssessmentID];

Can anyone see what I'm doing wrong? I suspect I may be trying to use 2005 features in a 2000 database but I can't see where.
 
you have a begin without an end

"NOTHING is more important in a database than integrity." ESquared
 
DOH!!!!

Many thanks for pointing out the blindingly obvious to me. :)
 
Hey we've all been there.

"NOTHING is more important in a database than integrity." ESquared
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top