SQL Server doesn't allow AFTER TRIGGER on VIEW

Bandi
Posted by Bandi under Sql Server category on | Points: 40 | Views : 305

--create sample view for a table
CREATE VIEW VW_TEST
AS
SELECT * FROM TableName
GO

-- try to create AFTER TRIGGER on above view
CREATE TRIGGER TR_AFTER_VIEWS
ON VW_TEST
AFTER INSERT
AS
SELECT 'INSERTING into views'
GO


Above trigger creation code gives error
"Msg 8197, Level 16, State 6, Procedure TR_AFTER_VIEWS, Line 1
The object 'VW_TEST' does not exist or is invalid for this operation .
"


NOTE: We must have to create INSTEAD OF trigger for VIEWs

Comments or Responses

Login to post response