Skip to content
Advertisement

Can’t add row in sql server because of date

I have a web application where I need to insert data in my SQL Server table, the problem is that I have this error in my Apache log:

General error: 241 Conversion failed when converting date and/or time from character string.

I have the same error when I try directly inside ms sql server. There is my php code :

And there is an example of data :

Advertisement

Answer

You must use a string-based date format, you should pick one that is safe and works in every SQL Server instance, regardless of date format, language and regional settings.

Convert String to Datetime

Convert Datetime to Date

AND here

SEE THIS ANSWER : Insert converted varchar into datetime sql

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement