Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
vgurgov
Starting Member
12 Posts |
Posted - 2007-02-06 : 15:23:36
|
Hi,I have this problem. I need to be able to convert a java Date string into a SQL Server datetime value.In other words, I have the following string in my database:Mon Mar 06 14:33:57 EST 2006and now this varchar(50) field in my table needs to be converted to the datetime field, which should convert this string to:2006-03-06 14:33:57I tried this alter table command:alter table my_tablealter column last_modified datetime but it produced this error:Syntax error converting datetime from character string. Is there a way of getting this done?Thanks a lot!VG |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2007-02-06 : 17:25:20
|
| Use substring commands to update it to 06 Mar 2006 14:33:57 then it will convert implicitly.==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
vgurgov
Starting Member
12 Posts |
Posted - 2007-02-07 : 18:41:46
|
| Thanks, it worked! |
 |
|
|
|
|
|