Error Could not complete cursor operation because the table schema changed after the cursor was decl

Muhammad Hamza
Kilo Sage

Hey everyone,

I have set up three data sources of type JDBC. I have scheduled three data imports daily at 12am Pacific. Using data sources, I am pulling data from the Azure SQL database from three tables separately.
The problem I am facing is getting this error in the Import log: Could not complete cursor operation because the table schema changed after the cursor was declared. This error only occurs for just one table not for the other two tables while pulling data using data sources. 
When this error occurs, the data pulling from Azure stops, and around 3.5 million records are pulled, while there are a total of 4.9 million records in the Azure SQL Database table. This error is also not consistent as it does not occur daily but randomly on some days.

The SQL statement I am running in the data source:

SELECT * FROM <TABLE_NAME>


Kindly help me in solving this error.

Thanks,

Hamza

1 ACCEPTED SOLUTION

Muhammad Hamza
Kilo Sage

Hey everyone, I have found a solution to my problem. It's an issue from the Azure Side.

Possible Cause:

The connection between ServiceNow and Azure SQL Database timeout. 

So to counter this, I am running the two data sources at midnight Pacific. The third data source executes at around 12:50 am Pacific.

I am also limiting the data import based on the orders sent in the last 6 months instead of all the orders. Which I achieved through running this specific query:

SELECT * FROM <TABLE_NAME> where ORDER_DATE >= Dateadd(Month, Datediff(Month, 0, DATEADD(m, -6,
current_timestamp)), 0)

This solved my problem. Hopefully, if someone else faces this similar problem, they can solve through this approach.

Regards,

Hamza

View solution in original post

1 REPLY 1

Muhammad Hamza
Kilo Sage

Hey everyone, I have found a solution to my problem. It's an issue from the Azure Side.

Possible Cause:

The connection between ServiceNow and Azure SQL Database timeout. 

So to counter this, I am running the two data sources at midnight Pacific. The third data source executes at around 12:50 am Pacific.

I am also limiting the data import based on the orders sent in the last 6 months instead of all the orders. Which I achieved through running this specific query:

SELECT * FROM <TABLE_NAME> where ORDER_DATE >= Dateadd(Month, Datediff(Month, 0, DATEADD(m, -6,
current_timestamp)), 0)

This solved my problem. Hopefully, if someone else faces this similar problem, they can solve through this approach.

Regards,

Hamza