Issues with Triggers and views

  • I am using a trigger to audit use of a database. This is an after update trigger that checks to see if the date lastmodified column in a table is equal to the same column in a view, when I run it in my trigger the condition is always faults - if I run the same query manually I get the correct outcome. Any ideas why I am seeing this issue?

  • JblakTSql (8/30/2010)


    I am using a trigger to audit use of a database. This is an after update trigger that checks to see if the date lastmodified column in a table is equal to the same column in a view, when I run it in my trigger the condition is always faults - if I run the same query manually I get the correct outcome. Any ideas why I am seeing this issue?

    hard to say without more detials; a view is just a saved SQL statement, run on demand, does the view point to the exact same table that the trigger is on? are you trying to get the lastmodified that occurred before the trigger fired(you need to use DELETED.lastmodified instead);

    show us the trigger code and what it was supposed to do, i'm sure we can help you sort out the issue.

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

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

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