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 |
|
kneel
Starting Member
36 Posts |
Posted - 2008-11-04 : 09:42:00
|
| Hello AlL,How can I convert varchar into small datetime ? my query is likeSELECT * FROM TABLE WHERE DATETIME = CONVERT(SMALLDATETIME,'21/10/2008 15:10:10')it gives me error asServer: Msg 242, Level 16, State 3, Line 1The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.Does anyone know how can I write this query ?Thanks in advance--kneel |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-11-04 : 09:50:27
|
| SELECT * FROM TABLE WHERE DATETIME = CONVERT(SMALLDATETIME,'20081021 15:10:10')MadhivananFailing to plan is Planning to fail |
 |
|
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2008-11-04 : 10:18:08
|
| SET DATEFORMAT DMYor 11/10/2008 will return Nov 10 instead of October 11, which looks like why your query produced and out-of-range errorJim |
 |
|
|
|
|
|