Convert NVARCHAR to DATETIME in SQL Server 2008

user2617053 picture user2617053 · Oct 7, 2013 · Viewed 126.2k times · Source

In my table

LoginDate  
2013-08-29 13:55:48  

The loginDate column's datatype is nvarchar(150)

I want to convert the logindate column into date time format using SQL command

Expected result.

LoginDate  
29-08-2013 13:55:48

Answer

user586399 picture user586399 · Jan 5, 2016
DECLARE @chr nvarchar(50) = (SELECT CONVERT(nvarchar(50), GETDATE(), 103))

SELECT @chr chars, CONVERT(date, @chr, 103) date_again