Sql-server – What data is causing an NVARCHAR/DATETIME conversion error

sql server

Application is getting this issue :
java.sql.SQLException: The conversion of a nvarchar data type to a datetime data type resulted in an out-of-range value."

Back end SQL Server 2014. How can i resolve this issue?

Best Answer

If this results from you passing data INTO SQL Server, log your parameters before you issue the query.

If this results from you getting data OUT of SQL Server, remove your cast/convert functions and look at the data. Odds are you're casting/converting a field that isn't guaranteed to be a date.