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 |
|
Sun Foster
Aged Yak Warrior
515 Posts |
Posted - 2005-09-22 : 08:57:15
|
| How to code to conver datetime data to smalldatetime? That is:from "06/10/2005 10:23 AM" to "06/10/2005". |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-09-22 : 09:00:28
|
| It depends where you want to use those converted datesIf you use them only for display purpose thenselect convert(varchar,Getdate(),101)MadhivananFailing to plan is Planning to fail |
 |
|
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
|
|
Sun Foster
Aged Yak Warrior
515 Posts |
Posted - 2005-09-22 : 09:23:46
|
| For the bigining, boss need only display. I used "convert(varchar,Getdate(),101)", it works. Now, boss want to add search feature to search time frame like "between #6/2/2000# and #6/30/2005#", can this type of data do it? |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-09-22 : 10:23:46
|
| Select Columns from yourTable Where DateCol >='20000206' and DateCol <='20050107'MadhivananFailing to plan is Planning to fail |
 |
|
|
derrickleggett
Pointy Haired Yak DBA
4184 Posts |
Posted - 2005-09-22 : 23:20:23
|
| Tell your boss to stop being a PHB and make up his mind. Madhivan's example will work. Here are all the datetime formats, just because it's more hits for my worthless blog I never update:http://weblogs.sqlteam.com/derrickl/archive/2005/01/08/3959.aspxMeanOldDBAderrickleggett@hotmail.comWhen life gives you a lemon, fire the DBA. |
 |
|
|
|
|
|