I am looking at creating a trigger on a live MS SQL spatial table that will update a field when a user either:
Creates a new feature
Updates the geometry of a feature.
Unfortunately I have only been able to work out updating a field when a new feature is created, or updating a field for every record when the geometry of a record is changed.
Ideal world - attribute 'Updated' populates current date for the particular feature that has been created or modified.
This is what I have so far that works only when creating a new feature:
SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TRIGGER *[triggername]* ON *[table]* AFTER INSERT,UPDATE AS BEGIN DECLARE @ID VARCHAR(8) SELECT @ID = [ID] FROM *[table]* UPDATE *[table]* SET Updated = GETDATE() WHERE [ID] = @ID END GO