convert

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
I use DateTime.Now and Serialize an object into XML field (Sql 2005).
the problem is that:
select CONVERT(datetime, '2006-10-09T13:54:06.9248089+02:00')

ERROR: Conversion failed when converting datetime from character string.

Any idea ?
 
Shalom Oren.

Read my post below about a problem in Insert.

What is the data type of the column? if its smalldatetime - you cannot use
SECONDS only days+months+years+hours+minutes.

HTH
Guy
 
Hello Oren,

SQL server doesn't recognize the string as a valid date string (T in the
string, number of digits, GMT bias), you must serialize it to proper format
i.e:
select CONVERT(datetime, '2006-10-09 13:54:06.924')

hope this helps
 
It will recognize the T in the string. It is the number of digits that is
the problem. Either of these will work

select CONVERT(datetime, '2006-10-09T13:54:06.924')

select CONVERT(datetime, '2006-10-09 13:54:06.924')


--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com

*************************************************
Think outside of the box!
*************************************************
 
Back
Top