Recently, I was inserting a date in a table in SQL Server, and after executing the insert query, I got this error SQL Server conversion failed when converting date and/or time from character string.
SQL Server conversion failed when converting date and/or time from character string.
I executed the SQL query below to insert a record in MyTable.
Insert Into MyTable(LastDate) Values ('2025-02-28');After executing the query below, I got this error: Check the screenshot below for your reference.

Solution
The reason for this error is that the date I am trying to enter is “2025-02-29,” and this is not a valid date because in February 2025, the last day is the 28th, and there is no 29th date in that month, so I got this error.
If I try changing the date to 28th or any other valid date with the same insert query, the record gets inserted successfully.
Insert Into MyTable(LastDate) Values ('2025-02-28');The above query executed successfully without any issues, and the record was inserted in the table without any issues, as shown in the screenshot below.

The key point here is always to ensure that you insert a valid date into the SQL Server table; otherwise, this type of error will appear.
Video Tutorial
You may also like the following articles.
- String or binary data would be truncated in table
- The datepart hour is not supported by date function dateadd for data type date.
- ‘to_date’ is not a recognized built-in function name.
- ‘EXTRACT’ is not a recognized built-in function name.
- The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.
After working for more than 15 years in the Software field, especially in Microsoft technologies, I have decided to share my expert knowledge of SQL Server. Check out all the SQL Server and related database tutorials I have shared here. Most of the readers are from countries like the United States of America, the United Kingdom, New Zealand, Australia, Canada, etc. I am also a Microsoft MVP. Check out more here.