Conversion failed when converting datetime from character string.

Error Message:
Msg 241, Level 16, State 1, Line 3
Conversion failed when converting datetime from character string.

Severity level:
16.

Description:
This error message appears, when SQL Server cannot convert a string to a valid DATETIME value.

Consequences:
The T-SQL statement can be parsed, but causes the error at runtime.

Resolution:
Error of the Severity level 16 are generated by the user and can be fixed by the SQL Server user.

Versions:
All versions of SQL Server.

Example(s):
DECLARE @dt VARCHAR(10)
SET @dt = ’2007011′
SELECT CAST(@dt AS DATETIME)

Remarks:
Invalid string values that should be converted are a frequent source of errors. One way to check if a string can be converted into a valid DATETIME value, is the use of the ISDATE() funktion.




Related Articles :

  • No Related Articles Found

No comments yet... Be the first to leave a reply!

Software Reviews | Book Reviews | FAQs | Tips | Articles | Performance Tuning | Audit | BI | Clustering | Developer | Reporting | DBA | ASP.NET Ado | Views tips | | Developer FAQs | Replication Tips | OS Tips | Misc Tips | Index Tuning Tips | Hints Tips | High Availability Tips | Hardware Tips | ETL Tips | Components Tips | Configuration Tips | App Dev Tips | OLAP Tips | Admin Tips | Software Reviews | Error | Clustering FAQs | Performance Tuning FAQs | DBA FAQs |