Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Set Focus SQL Portfolio
1. SetFocus SQL Portfolio SetFocus has designed The Masters Program: SQL Server training track to help bring database administrators to the next level in their careers, utilizing Microsoft SQL Server 2005 integrated closely with Visual Studio 2005.
4. DML Triggers -- =============================================== -- Author: Brent Bybee -- Create date: 01-08-2009 -- Description: Trigger to prevent deletes and -- updates on the transactions table -- =============================================== CREATE TRIGGER [dbo].[NoChangesToTransactions] ON [dbo].[Transactions] INSTEAD OF DELETE, UPDATE NOT FOR REPLICATION AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON; RAISERROR (N'Transactions cannot be deleted, or updated.', -- Message 10, -- Severity. 1); -- Statua -- Rollback any active or uncommittable transactions IF @@TRANCOUNT > 0 BEGIN ROLLBACK TRANSACTION; END END; -- =============================================== -- Author: Brent Bybee -- Create date: 01-08-2009 -- Description: Trigger to prevent deletes and -- updates on the transactions table -- =============================================== CREATE TRIGGER [dbo].[NoChangesToTransactions] ON [dbo].[Transactions] INSTEAD OF DELETE, UPDATE NOT FOR REPLICATION AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON; RAISERROR ( N'Transactions cannot be deleted, or updated.', -- Message 10, -- Severity 1); -- Statu s -- Rollback any active or uncommittable transactions IF @@TRANCOUNT > 0 BEGIN ROLLBACK TRANSACTION; END END;