Reputation: 36895
I have an updatable view (vwItem) being accessed via a linked server ([sql\dev].)
When I update the view with a static data, the underlying table gets updated.
UPDATE ci SET CertifiedNumber = '44444'
FROM [sql\dev].contact.dbo.vwItem ci WITH (NOLOCK)
WHERE ci.CertifiedBatchID IN ( 5829 )
But when I try to pass a dynamic value,
declare @lo_vch_CertifiedNumber varchar(50) = '1111111111222222222233333'
UPDATE ci
SET CertifiedNumber = @lo_vch_CertifiedNumber + '44444'
FROM [sql\dev].contact.dbo.vwItem ci WITH (NOLOCK)
WHERE ci.CertifiedBatchID IN ( 5829 )
it fails, with following error message
The statement has been terminated.
Msg 16932, Level 16, State 1, Line 1
The cursor has a FOR UPDATE list and the requested column to be updated is not in this list.
I don't even use a cursor but the error mentions a cursor..
Here is the definition of "vwItem".
CREATE view [dbo].vwItem
with schemabinding
AS
select CertifiedItemID = cast(CertifiedItemID as varchar),
CertifiedNumber, [Service], Weight, Price, CertifiedBatchID
from dbo.tblItem (nolock)
Why does the error occur and what does it mean?
Upvotes: 0
Views: 91
Reputation: 36895
Got around the problem by implementing a sproc that updates vwItem instead of using updatable view
Upvotes: 0