jeudi 26 mars 2015

Upgrading a database from sql server 2005 to 2012 uncovered a syntax error


I recently upgraded a SQL server from 2005 to 2012.

During validation however, a bug was discovered.


A certain trigger was coded as follows:



CREATE TRIGGER [dbo].[trigger] on [dbo].[table]
FOR UPDATE, UPDATE
AS
UPDATE table
set datetime = GetDate()
FROM table2
WHERE table.id = table2.id
GO


I can safely execute this (oddly) on 2005.

However on 2012 it throws (what I would expect) a syntax error.

Syntax error: Duplicate specification of the action "UPDATE" in the trigger declaration.


Why does this not throw a syntax error on 2005? My google-fu on this has failed me.

Why does this seemingly work on 2005?





Aucun commentaire:

Enregistrer un commentaire