Hi All,
I have a SQL script to insert data into a table as below:( I am using Linked Servers scenario )
INSERT into [SRV1\INS2].BB.dbo.Agents2
select * from [SRV2\INS14].DD.dbo.Agents
I just want to set a Trigger on Agents2 Table, which could delete all rows in the table , before carry out any Insert operation using above statement.
I had below Table Trigger on [SRV1\INS2].BB.dbo.Agents2 Table as below: But it did not perform what I intend to do.
USE [BB]
GO
/****** Object: Trigger Script Date: 24/07/2015 3:41:38 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
--USE BB
ALTER TRIGGER [dbo].[MyTrigger] ON [dbo].[Agents2]
For INSERT
AS
BEGIN
DELETE From Agents2
END
Appreciate any advice.
Regards
Mira