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
 Transact-SQL (2000)
 Error updating text column and clustering key

Author  Topic 

Arnold Fribble
Yak-finder General

1961 Posts

Posted - 2004-07-01 : 06:23:16
Does anyone know a minimal test case that produces this error:

"The query processor could not produce a query plan from the optimizer because a query cannot update a text, ntext or image column and a clustering key at the same time. (#8629)"

It's documented in BOL for Update:
"If an update query could alter more than one row while updating both the clustering key and one or more text, image, or Unicode columns, the update operation fails and SQL Server returns an error message."

as I interpret it, that mean that this should fail, but it doesn't:

create table ttest (
pk1 int not null,
pk2 int not null,
t text,
primary key clustered (pk1, pk2)
)

insert into ttest (pk1, pk2, t)
select 1, 1, 'the test'

insert into ttest (pk1, pk2, t)
select 1, 2, 'qwreqwerwre'

update ttest
set pk1 = 5, t = 'qwerqwre'
where pk1 = 1


Anybody got any ideas?

Edit: Found this thread

http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&selm=PhOcB0zNEHA.2692%40cpmsftngxa10.phx.gbl

Ho hum, it seems to make a difference what the text value is: if the literal string in the update 'qwerqwre' is changed to, say, LEFT('qwerqwre',8) then it produces the error.

MRIGUY
Starting Member

17 Posts

Posted - 2004-07-01 : 14:36:09
It probably has to do with the size of you text column. Look up 'Text in Row option' in SQL BOL. It explains data in text fields are stored with the existing row data upto a certain amount of bytes. When I used your example with very large text field data, I did get the error.
Go to Top of Page
   

- Advertisement -