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)
 Delete Trigger

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-08-24 : 10:09:12
Paul writes "Hi,

I have a table that contains jobs. When a job is deleted I need to copy the deleted job to an archive table. I'm currently doing this in an ASP page but I'd like to move this business rule to a trigger so that it's easier to maintain and so that no matter how a job is deleted (via ASP page or Query Analyzer or whatever) a copy of the job gets archived.

I wrote the trigger like this:

CREATE TRIGGER jobs_delete ON jobs
FOR DELETE
AS

insert into archive
(
jobid,
jobtitle,
description
)

select
jobid,
jobtitle,
description
from deleted

When it runs I get error 311, Cannot use text, ntext, or image columns in the 'inserted' and 'deleted' tables.

I'm using SQL Server 7. Any ideas on how I might get this to work?

Thanks!"

MAK66
Starting Member

1 Post

Posted - 2005-06-16 : 14:05:24
jobtitle,description should be char or nvarchar.
In your setuation one of them or both is of type ntext.

The join will not work, I have try it.

try to change the type of jobtitle,description to be nvarchar.

Regards,


We can do it.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2005-06-16 : 14:08:39
Hopefully the original poster already figured it out as this thread is 4 years old!

Tara
Go to Top of Page
   

- Advertisement -