Tag Info

Hot answers tagged

1

When the utility runs, just have it (or whatever calls the utility) run this command: DISABLE TRIGGER dbo.trigger_name ON dbo.table_name; And then afterward: ENABLE TRIGGER dbo.trigger_name ON dbo.table_name; It would be better to have the utility do this just around the statement(s) affecting this table specifically (and wrap that in a transaction), ...


1

Need parentheses in the WHEN part: CREATE TRIGGER connections_INSERT_update_connection_root_trg AFTER INSERT ON dionaea.connections FOR EACH ROW WHEN (NEW.connection_root IS NULL) EXECUTE PROCEDURE dionaea.connections_INSERT_update_connection_root_trg(); You also need to return NEW in your trigger function. create or replace function ...


1

It is actually possible to do this neatly without using triggers if you are using InnoDB. Create another table with just one column. That column should have a foreign key (hence the innodb requirement in this solution) that points to the immutable column of the original table in question. Put a restriction like "ON UPDATE RESTRICT". In summary: CREATE ...


1

For DML changes you can utilize any of the followinh native SQL Server auditing features: SQL Server Change Tracking SQL Server Change Data Capture SQL Server Auditing Each has its advantages and disadvantages, but the Auditing is the latest introduced by Microsoft, so it would be a good idea to build your current and future solutions wrapped with it. ...



Only top voted, non community-wiki answers of a minimum length are eligible