Solved

trigger with ntext value

Posted on 2009-05-11
4
463 Views
Last Modified: 2012-05-06
I have a trigger,
But am having a problem updating the comp_notmaintained value as its of type ntext.
If I remove this value it works with the other two.

Please can anyone suggest a workaround?

Many thanks,

Mim
CREATE trigger [trg_updatecomp]
  on [dbo].[Installed]
 for update
as
  update Company
    set comp_inststatus
      = i.inst_status, comp_expirydate = i.inst_expirydate, comp_notmaintained = i.inst_notmaintained
from Installed q 
join inserted i
on i.inst_companyid = q.inst_companyid

Open in new window

0
Comment
Question by:MimUK
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 24354557
you cannot update the text column with an update statement, you need to use UPDATETEXT /WRITETEXT
0
 
LVL 92

Expert Comment

by:Patrick Matthews
ID: 24354573
MimUK said:
>>Please can anyone suggest a workaround?

If you are using SQL Server 2005 or later, use nvarchar(max) instead of ntext.
0
 

Author Comment

by:MimUK
ID: 24354577
Please could you help with what I need to replace in the trigger.
i cannot change the column type as its fixed in the application

Mim
0
 
LVL 22

Accepted Solution

by:
dportas earned 125 total points
ID: 24357521
This should work:

CREATE TRIGGER [trg_updatecomp]
  ON [dbo].[Installed]
 FOR UPDATE
AS
  UPDATE Company
    SET comp_inststatus
      = i.inst_status, comp_expirydate = i.inst_expirydate, comp_notmaintained = q.inst_notmaintained
  FROM Installed q
  JOIN inserted i
  ON i.inst_companyid = q.inst_companyid
  JOIN Company
  ON i.inst_companyid = Company.inst_companyid ;
GO

0

Featured Post

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

'Between' is such a common word we rarely think about it but in SQL it has a very specific definition we should be aware of. While most database vendors will have their own unique phrases to describe it (see references at end) the concept in common …
Confronted with some SQL you don't know can be a daunting task. It can be even more daunting if that SQL carries some of the old secret codes used in the Ye Olde query syntax, such as: (+)     as used in Oracle;     *=     =*    as used in Sybase …
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question