Trigger Problem

  •  Hi,

    I have a table which includes a TEXT datatype column. I want to write an insert trigger on the table to place new records into an archive table for safekeeping.  When I checked the syntax, I received the error message 311

    "CANNOT USE TEXT, NTEXT, OR IMAGE COLUMNS IN THE INSERTED OR DELETED TABLES"

     

    Is there any workaround for this? It is vital that I have a mechanism to place all new records into another table as soon as they are written.

  • Hi,

    Text, ntext and image columns cannot be referenced in the inserted or deleted tables when using a (normal) AFTER trigger. However they are allowed in a INSTEAD OF trigger, which requires sqlserver 2000. (see BOL on Designing Triggers)

    To workaround the limitation in a normal trigger you could retrieve the data in a text, ntext or image column by joining the inserted/deleted table with the original table in the trigger.

    /Fredrik

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

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