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 |
|
rcr69er
Constraint Violating Yak Guru
327 Posts |
Posted - 2008-04-24 : 07:48:46
|
| HiIs there a way to format a field in a table with a datetime data type to show just the date?ie. 24/04/2008 17:25:00 would just become 24/04/2008.Even showing 24/04/2008 00:00:00 would be helpful.Thanks |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-04-24 : 08:54:50
|
| select dateadd(day,datediff(day,0,col),0) from your_tableMadhivananFailing to plan is Planning to fail |
 |
|
|
rcr69er
Constraint Violating Yak Guru
327 Posts |
Posted - 2008-04-24 : 09:00:45
|
| HiWhat about when inserting data into the field?Thanks |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-04-24 : 10:30:48
|
| Insert into table(datecol)select dateadd(day,datediff(day,0,getdate()),0)MadhivananFailing to plan is Planning to fail |
 |
|
|
rcr69er
Constraint Violating Yak Guru
327 Posts |
Posted - 2008-04-24 : 10:48:16
|
| Hey, Thanks for that!!! |
 |
|
|
|
|
|