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.
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.