Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 How can I copy ntext field values from DELETED table to another table with a trigger on SQL7?

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2000-12-11 : 09:49:49
Wayne writes "I am using MS SQL Server 7 and when I make an update or deletion to one of my tables that contains a field of the ntext datatype, I would like a trigger to automatically copy all of the original contents (along with some additional data) to a similar table that will function as an audit table.

I wish to use the audit table to keep track of each revision made to the original table and be able to perform queries against the audit table. These queries would be up to and including returning the exact text of one of the revisions.

I was wondering if there is a way to do this in tSQL using a trigger. This works with no problems when I use nvarchar or any of the smaller datatypes. When I try to select the contents of the field that is ntext from the DELETED table, I get the following error:

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

I would prefer not to have to write code in each of the applications that access and update this table to make the appropriate updates in the audit table.

Is what I am asking for simply not possible?"
   

- Advertisement -