convert

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 ?
 
G

Guy Cohen

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
 
G

Guest

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
 
C

Cowboy \(Gregory A. Beamer\)

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')
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,989
Messages
2,570,207
Members
46,782
Latest member
ThomasGex

Latest Threads

Top