You're essentially intercepting ALL updates, and not allowing them to happen. Per BOL:
In contrast with the AFTER trigger, the INSTEAD OF trigger fires before constraint processing and replaces the normal triggering action with the actions defined in the trigger. For example, an INSTEAD OF trigger attached to a view of historical sales data can prevent the data from being modified by replacing the insert, update, and delete triggering actions with a customized error message. Because the INSTEAD OF trigger supersedes the triggering action, the data modification that caused the trigger to execute in this example is never executed. The INSTEAD OF trigger code must include the appropriate INSERT, UPDATE, or DELETE statements if those actions are required. Executing the INSERT, UPDATE, or DELETE statement from inside the INSTEAD OF trigger code will not fire the same trigger again; instead, the insert, update, or delete action is performed.
you're not reissuing the update from within the trigger, so no update ever occurs. You'd have to add an UPDATE statement, based on the INSERTED table.
Something like (I was also curious why you're checking the DELETED table and not the INSERTED table):
USE [joblist]
GO
/****** Object: Trigger [toempemails] Script Date: 06/11/2008 14:19:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create TRIGGER [toempemails]
on [dbo].[empemails] INSTEAD OF UPDATE
as
BEGIN
IF EXISTS (SELECT * FROM deleted WHERE companyname like '%.js')
begin
print 'trying to insert virus'
end
ELSE
begin
update toempemails
set col1=inserted.col1,
col2=inserted.col2
--etc....
from toempemails
inner join inserted i on toempemails.ID=i.ID
end
end
--select * from empemails
Keep in mind that you might be tossing out a bunch of good rows, based on just one being bad, so you might care to rewrite the trigger to only apply to those rows without the '.js' extension. Just do that within the WHERE clause of the update.
----------------------------------------------------------------------------------
Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?