Friday, February 24, 2012

Could not complete cursor operation because the table schema changed

Microsoft SQL Server 2000 - 8.00.2039

Got this error:

Could not complete cursor operation because the table schema changed after the cursor was declared. SQLCode: 16943 SQLState: HY000

Is this a known issue? I suspect the application logic may cause this error. Please advise.

Thanks a lot!

Is the message accurate?

Does your app change the table(s) that the cursor is using?

/Kenneth

|||

I am running into the same issue. The table is not being altered. Here is an outline of what I am doing.

A cursor loop is running in a stored procedure (looping through server and drive letters). In the loop it calls a stored procedure that does the following:

DBCC CHECKIDENT (zstblACLSStage,RESEED,0)

SET @.strSQL = 'INSERT INTO zstblACLSStage(LN) SELECT LN = RTRIM(LTRIM(REPLACE(F1,CHAR(9),'''')))
FROM OPENROWSET
(
''Microsoft.Jet.OLEDB.4.0''
,''Text;Database=' + @.strDirectory + ';HDR=NO''
,''SELECT * FROM ' + @.strFile + '''
)
WHERE ISNULL(REPLACE(F1,CHAR(9),''''),'''') != '''''
PRINT @.strSQL
EXECUTE (@.strSQL)

More processing here transfers some data from zstblACLSStage to tblACLS

DELETE FROM zttblACLSStage

This is all run from a scheduled task in SQL. If I kick the job off manually, it will run and complete. If it runs scheduled for overnight, the EXECUTE will get the error message. It happens the 7th time through the loop and it always happens. I am suspecting the DBCC so I am commenting that out to give it another try, any suggestions are welcome.

|||

Can you give the select statement that creates your cursor?

|||

Hi All,

Even I am getting the same error while querying the SQL 2000 database table from ASP. I use a select statement , containing outer joins, and sometimes this error pops up.

Thanks,|||

Could you also update me if you get an answer on this. I am also facing similar issue. My system is throwing the same error every once in a while and if we do the same operation again, it works fine. I verified with maintenance jobs also and they are not conflicting.

Please Help !!!!!

No comments:

Post a Comment