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 |
arkiboys
Master Smack Fu Yak Hacker
1433 Posts |
Posted - 2007-07-18 : 12:03:36
|
hi,How do I convert this into smalldatetime please?I am doing this because there is a field of type varchar which has to go into a separate table with field of type smalldatetime.select convert(smalldatetime, '14/10/04', 101)This is what I have but the error is:Conversion failed when converting character string to smalldatetime data type. |
|
rmiao
Master Smack Fu Yak Hacker
7266 Posts |
Posted - 2007-07-18 : 12:17:15
|
Style is for converting datetime or smalldatetime data to character data. |
 |
|
arkiboys
Master Smack Fu Yak Hacker
1433 Posts |
Posted - 2007-07-18 : 16:07:34
|
Not sure what you mean.Thanks |
 |
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts |
Posted - 2007-07-18 : 17:01:11
|
It means that the "style" (101), only applies when you are converting from datetime or smalldatetime to a character string, not when converting from a string to datetime or smalldatetime.This should work:set dateformat dmyselect MyDateString =convert(smalldatetime, '14/10/04')Results:MyDateString--------------------2004-10-14 00:00:00(1 row(s) affected) CODO ERGO SUM |
 |
|
arkiboys
Master Smack Fu Yak Hacker
1433 Posts |
Posted - 2007-07-19 : 02:57:02
|
Thanks |
 |
|
|
|
|