convert nvarchar to smalldatetime in sql server -


i have 1 table in nvarchar data there.

table 18-feb-11 10.29.52.000000000 20-feb-11 04.10.40.000000000 pm 23-sep-10 10.34.57.714000000 08-oct-10 09.41.16.921000000 pm 

i want convert field small date time in sql server 2008 r2

how can convert it.

expected output:  2011-02-18 10:29:52 2011-02-20 16:10:40 2010-09-23 10:34:57 2010-10-08 21:41:16 

try please

declare @s_date nvarchar(100)= '18-feb-11 10.29.52.000000000 am' select convert(nvarchar(100),cast(replace(replace(@s_date, substring(@s_date, 19, 10),''),'.',':') datetime), 120)  result : 2011-02-18 10:29:52 

Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

android - CollapsingToolbarLayout: position the ExpandedText programmatically -

Listeners to visualise results of load test in JMeter -