July's Course of the Month is now available! Enroll to learn HTML5 and prepare for certification. It's free for Premium Members, Team Accounts, and Qualified Experts.
ALTER TRIGGER trigger1 ON TABLE1 INSTEAD OF DELETE AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON; DECLARE @var1 varchar(20) DECLARE @var2 datetime DECLARE @var3 datetime DECLARE @var4 datetime DECLARE @var5 TINYINT DECLARE @var6 VARCHAR(10) SET @var2 = getDate() SELECT @var1 = uid, @var3 = var3, @var4 = var4, @var5 = var5 FROM DELETED IF @var3 < 1 BEGIN INSERT INTO TABLE2 (var1, var2, var3, var4, var5) VALUES (@var1, @var2, @var3, @var4, @var5) END DELETE FROM TABLE1 WHERE uid = @var1 END
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.