Hi Guys,
I encounter error when i converting the string into datetime.
My datetime field is shipdate and returndate.
also there is a Null value both of this field.
btw, here is my code. can you please modify my code
any idea that you can share with me to fixed this problem.
Msg 241, Level 16, State 1, Line 1
Conversion failed when converting datetime from character string.
Insert into chrismartin.dbo.TestTable3
select
a.esn,
a.sku,
a.model,
a.failcode,
a.Shipreturntype,
a.Returndate,
--Case when a.Shipdate in 'NULL' then ''
--Else
case when a.Shipdate is not NULL then
Convert(datetime,(STR(DATEPART(yy, a.reshipdate)) + '/'+ STR(DATEPART(mm, a.reshipdate))+'/' + STR(DATEPART(dd, a.reshipdate)))) --as usshipdate
--a.Shipdate,
--Else
-- a.shipdate --= 'NULL'
End As usshipdate,
--else
a.Returndate,
--Convert(datetime,(STR(DATEPART(yy, a.Reshipdate)) + '/'+ STR(DATEPART(mm, a.Reshipdate))+'/' + STR(DATEPART(dd, a.Reshipdate)))) as usReshipdate,
--a.Reshipdate,
--End as
a.SalesId,
a.Asu_notes
From chrismartin.dbo.TestTable4 as a
You help is very much appreciated.
Thank you in Advance.
Jonel