creating a trigger on a thread

  • Hi All

    im trying for the first time to create a trigger on a view

    example:

    create view testview

    as

    select * from somewhere

    ----------------------

    create trigger test

    on testview

    for update

    as

    begin

            doing somthing ...........

    end

    ......but when i execute the create trigger i get an error :

    invald object name 'testview'

     

    are there paramaters a view must have inorder to create a trigger on it.....like indexed view or somthing........

  • Hi Oren,

    The documentation says 'A view can be referenced only by an INSTEAD OF trigger.':

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_create2_7eeq.asp

    So try:

    create trigger test

    on testview

    instead of update

    as

    begin

            doing somthing ...........

    end

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply