Convert nvarchar to datetime in SQL Server 2008 ar

2019-09-20 13:25发布

问题:

I am trying to convert nvarchar values with the format 3/7/2013 to datetime but I can't quite figure it out. I am using SQL Server 2008 and keep getting an

Arithmetic overflow error converting expression to data type datetime

error.

回答1:

This works fine:

SELECT CAST (N'3/7/2013' as datetime)