To me this is a trigger that will update a date column with the current datetime. Your example could see the where clause below that finds the row that is either just created or just updated. You can't be changing the column that is a part of the where clause.
CREATE TRIGGER dbo.MyTable_UpdatedON dbo.Table1FOR INSERT, UPDATE /* Fire this trigger when a row is INSERTed or UPDATEd */AS BEGIN UPDATE dbo.Table1 SET dbo.Table1.LastUpdated = GETDATE() FROM INSERTED WHERE inserted.id=Table1.idEND
On Tue, Aug 15, 2017 at 10:06 PM, < mbsoftwaresolutions@mbsoftwaresolutions.com> wrote:
MariaDB backend (but could be SQL Server too)
Given this trigger: UPDATE MyTable SET cItemID = new.cID WHERE cItemID = old.cID
My question: will this trigger fire even if the old.cID = new.cID? Or do I need to add to the WHERE clause something like "....and old.cID <> new.cID"
???
tia, --Mike
[excessive quoting removed by server]