Forum Discussion

chuckmi's avatar
chuckmi
Copper Contributor
Sep 25, 2024

How to fix this error "Error encountered while parsing data"?

I have an MS SQL server installation which is an Azure Synapse SQL server. The Azure database is a copy of an original database. I have confirmed the field Shiptable.mydate is in Azure SQL database. I'm using Power BI from July 2024 to read the data but this seems like an SQL Server error. I'm not the SQL Server or Azure admin though.

 

I sometimes look at a date field and grab records from the last N days, like last 60 days. This formula works on all other date fields on other tables: WHERE (mydate >= DATEADD(day, -50, GETDATE()) )

 

But it doesn't work on a date field Shiptable.mydate. When I do this

 

 

WHERE (mydate >= DATEADD(MONTH, -13, CAST(GETDATE() AS DATE)))

 

 

on Shiptable I get this error: 

 

DataSource.Error: Microsoft SQL: Error encountered while parsing data: 'Inserting value to batch for column type DATETIME2 failed. Invalid argument provided.'.

 

The field type, seen via SSMS, is indeed datetime2. 

 

EDIT: Running the query in SSMS with the WHERE clause above also fails with the same error. It takes over 2 minutes to fail. 

 

Any idea how to fix this? 

 

Thank you.

 

No RepliesBe the first to reply

Resources