Search code examples
sql-servertriggers

Cannot use text, ntext, or image columns in the 'inserted' and 'deleted' tables


I got an error "Cannot use text, ntext, or image columns in the 'inserted' and 'deleted' tables", since there are ntext fields in original table, I had attached a trigger to.

Here is a solution: http://lazycodeprogrammer.blogspot.com/2009/08/how-to-use-inserteddeleted-with.html

But original (non modified) query is complex enough. What should I write instead of SELECT * FROM INSERTED, using JOIN operator, as it's recommended?


Solution

  • A nice solution has been found:

    1. SELECT FROM INSERTED just id column (it's not ntext or image and query is being executed).
    2. SELECT from original table * with the same ids.
    3. If required, use UPDATED() on INSERTED to be aware, what columns have been changed.