I am trying to update image field using java program. I am getting the following error.
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]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.
I did n't have any index defined on the table. Please halp me in this.
I am writing the following method to update image field.
query = "UPDATE PTL_DOCS SET DOC_TYPE=?, DOC_NAME=?, MODIFIED_BY=?, MODIFIED_ON="+DateUtility.getDateTime()+",NOTES=?, + TYPE=?,BACKGROUND_TYPE=?, DOC_MIME_TYPE = ? ,DOC_SIZE = ? , DOC_CONTENT = ?, FRM_ID =? , VERSION_NUMBER = ? WHERE PTL_NUMBER=? AND PTL_DTLS_ID=? AND SEQ_NUMBER=?";
My table is not having any index defined. I checked in the Query Analyzer. My table is like the following
CREATE TABLE PTL_DOCS ( PROJ_ID VARCHAR(30) NOT NULL, PTL_DTLS_ID INT NOT NULL, SEQ_NUMBER INT NOT NULL identity(1,1), PTL_NUMBER INT NOT NULL, DOC_TYPE VARCHAR(256) NOT NULL, DOC_NAME VARCHAR(256) NOT NULL, DOC_MIME_TYPE VARCHAR(256) NOT NULL, DOC_SIZE INT, DOC_DATE DATETIME NOT NULL, APPROVED_DATE DATETIME, CREATED_BY VARCHAR(30) NOT NULL, CREATED_ON DATETIME NOT NULL, MODIFIED_BY VARCHAR(30) NOT NULL, MODIFIED_ON DATETIME NOT NULL, FRM_ID INT, NOTES VARCHAR(2000), DOC_CONTENT IMAGE, TYPE VARCHAR(30), VERSION_NUMBER INT, CONSENT_LOCK VARCHAR(1) DEFAULT 'Y', BACKGROUND_TYPE VARCHAR(200) );
SQL Server automatically creates unique indexes when you use a Primary Key constraint. Unless you explicitly specify a non-clustered index, a clustered index is created to enforce the Primary Key constraint, which is probably what is causing your problem.
I am sollve the problem. I was trying to update the image field and one of the key field (One of the filed on which primary key is defined ). Sql server is not allowing update. I am updating image in a seperate query and That filed in a seperate query.
I am going to test your electrical conductivity with this tiny ad:
a bit of art, as a gift, the permaculture playing cards