07-30-2012 11:34 AM
We are using CVI 8.5 and SQL Toolkit 2.0.6 to write data to a SQL Server 2008 database. We are utilizing the Microsoft ODBC SQL Server (non-native) driver. We build a transaction that calls stored procedures on the database to write the data. Occasionally we get the following error:
"Could not complete cursor operation because the table schema changed after the cursor was declared"
The error is unusual since we only use one cursor and it is in a stored procedure that gets called by other software hundreds of times a day and never fails. Our database is also designed to only append records, not change existing ones. We're trying to pinpoint the error and I'm wondering if anyone knows if the SQL Toolkit uses cursors to build transactions or if this error has been seen by others. Since upgrading the toolkit or drivers takes a lot of effort, I want to make sure that I understand the problem before I start throwing darts at it. Thanks in advance for any insight.
07-31-2012 03:32 PM
Hi CareFish,
Have you been able to track down what line is producing the error?
Regards,
07-31-2012 03:53 PM
I've attached the function that's failing. Unfortunately, the code isn't designed with much resolution as to what SQL toolkit call failed, since these calls haven't failed once validated and put into the production environment. Can you tell if any of these functions use a cursor. I could certainly try adding more resolution to the error handling, but since we've only seen errors occasionally in the production environment, I'd need to release a temp version and monitor it. Let me know what you think. Thanks.
08-01-2012 02:49 PM
If you could try increasing the precision to which we can error check, that would really help us out. I haven't seen anything in NI's documentation yet that alludes to the behavior you're seeing. If you track down where it's coming from, let us know.
Cheers,
08-07-2012 10:52 AM
The problem has cured itself. It's almost like the database or server is caching information and it takes some number of transactions to clear it. If I see it again, I'll increase the error resolution and re-post. Thanks.