We help IT Professionals succeed at work.
Get Started

SQL studio delete trigger

lantervj
lantervj asked
on
326 Views
Last Modified: 2012-06-21
I'm trying to do a simple trigger where any delete to the table will generate an error.

USE [TTdev]
GO
/****** Object:  Trigger [dbo].[sales_center_CRM_companies_Delete]    Script Date: 11/01/2011 15:15:37 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:&#9;&#9;<Author,,Name>
-- Create date: <Create Date,,>
-- Description:&#9;<Description,,>
-- =============================================
ALTER TRIGGER [dbo].[sales_center_CRM_companies_Delete]
   ON  [dbo].[Sales_Center_CRM_Companies]
   AFTER DELETE
AS
BEGIN
&#9;-- SET NOCOUNT ON added to prevent extra result sets from
&#9;-- interfering with SELECT statements.
&#9;SET NOCOUNT ON;

    RAISERROR ('This is a special error message for Vaughn. Let him know ASAP.',100,1);

END
go


I'm not getting an error when deleting a row using studio.
Comment
Watch Question
CERTIFIED EXPERT
Commented:
This problem has been solved!
Unlock 1 Answer and 9 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE