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 |
|
Lorna70
Starting Member
19 Posts |
Posted - 2010-05-25 : 05:46:09
|
| Hi I have a field in one of my tables which has a smalldatetime datatype and this has been causing me problems in creating a select statement to select all records before 30/10/2010.I have tried all sorts of statements trying CAST, CONVERT and FLOOR to no avail!The last one I tried was:SELECT *FROM tblLoadsWHERE JobDate < '30-10-2009 00:00:00' Looking at dates in the table, they are displayed in this format (UK).Any advice would be greatly appreciated :-) |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-05-25 : 05:48:28
|
Try:WHERE JobDate < '20091030' No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
Lorna70
Starting Member
19 Posts |
Posted - 2010-05-25 : 07:19:51
|
| I don't believe it! This worked and it's so simple too. Many thanks, Lorna |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-05-25 : 07:21:04
|
welcome  No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-05-25 : 10:02:08
|
quote: Originally posted by Lorna70 I don't believe it! This worked and it's so simple too. Many thanks, Lorna
It is becuase DD-MM-YYYY is specific to server setting whereas YYYYMMDD is unambigiousMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|