代码
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
ALTER TRIGGER [dbo].[DenyDelete]
ON [dbo].[tbsmstemplate]
for delete
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for trigger here
if exists (select 1 from deleted where fsmstemplateid in (22,23,24,25))
begin
RAISERROR ('不能删除id=0的记录', 16, 1)
ROLLBACK TRANSACTION
end
END
set QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
ALTER TRIGGER [dbo].[DenyDelete]
ON [dbo].[tbsmstemplate]
for delete
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for trigger here
if exists (select 1 from deleted where fsmstemplateid in (22,23,24,25))
begin
RAISERROR ('不能删除id=0的记录', 16, 1)
ROLLBACK TRANSACTION
end
END