Skip to content

Instantly share code, notes, and snippets.

@radityopw
Created June 5, 2021 13:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save radityopw/cbe76f6b0454c5cbbbfca794b8cd5287 to your computer and use it in GitHub Desktop.
Save radityopw/cbe76f6b0454c5cbbbfca794b8cd5287 to your computer and use it in GitHub Desktop.
readonly table trigger
CREATE TRIGGER <schema>.<table_name>_read_only_events ON <schema>.<table_name>
INSTEAD OF INSERT,
UPDATE,
DELETE
AS
BEGIN
RAISERROR( 'table is read only.', 16, 1 )
ROLLBACK TRANSACTION
END
DROP TRIGGER <schema>.<table_name>_read_only_events;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment