I need to update the DateModified Column without knowing the name of the Primary Key Column.
Basically, I've got a plain-jane UPDATE trigger like this:
CREATE TRIGGER updated_SCHEMA_TABLE
ON [SCHEMA].[TABLE]
AFTER UPDATE AS
BEGIN
SET NOCOUNT ON;
UPDATE [SCHEMA].[TABLE]
SET DateModified = getdate()
WHERE [PRIMARYKEY]
IN (SELECT [PRIMARYKEY]
FROM Inserted)
END
but won't know the primary key's column name because the trigger will be generated programmatically (see this question as to why).
Is this possible?