Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- -- =============================================
- -- Author: <Author,,Name>
- -- Create date: <Create Date,,>
- -- Description: <Description,,>
- -- =============================================
- CREATE TRIGGER DELETE_Loc
- ON dbo.Location
- FOR DELETE
- AS
- IF EXISTS (SELECT COUNT(*) FROM deleted, Company
- WHERE Company_Id = deleted_Id )
- BEGIN
- -- SET NOCOUNT ON added to prevent extra result sets from
- -- interfering with SELECT statements.
- --SET NOCOUNT ON;
- -- Insert statements for trigger here
- PRINT 'You cannot delete Location because Company exists'
- ROLLBACK TRANSACTION
- END
- GO
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement