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 |
|
sanjnep
Posting Yak Master
191 Posts |
Posted - 2007-10-31 : 13:06:37
|
| I have date value 2005-11-29 11:24:08.443 on one table and I want this format 2005-11-29 00:00:00.000 to insert another table on datetime column. How can I do this?ThanksSanjeev |
|
|
dinakar
Master Smack Fu Yak Hacker
2507 Posts |
Posted - 2007-10-31 : 13:09:30
|
| DATEADD(d,0,DATEDIFF(d,0,YourDatetimeColumn))Dinakar Nethi************************Life is short. Enjoy it.************************http://weblogs.sqlteam.com/dinakar/ |
 |
|
|
sshelper
Posting Yak Master
216 Posts |
Posted - 2007-10-31 : 13:09:50
|
| To remove the time part in you DATETIME column, you can do the following:SELECT DATEADD(DD, DATEDIFF(DD, 0, '2005-11-29 11:24:08.443'), 0)SQL Server Helperhttp://www.sql-server-helper.com |
 |
|
|
sanjnep
Posting Yak Master
191 Posts |
Posted - 2007-10-31 : 13:29:49
|
| Thanks a lot......... |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-11-01 : 02:35:48
|
I prefer using day instead of D or DD for more clarity More infor on querying dateswww.sql-server-performance.com/fk_datetime.aspMadhivananFailing to plan is Planning to fail |
 |
|
|
ranganath
Posting Yak Master
209 Posts |
Posted - 2007-11-02 : 02:19:21
|
| try this alsoSelect cast(convert (varchar(12), getdate(),101) as Datetime ) |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-11-02 : 03:03:35
|
quote: Originally posted by ranganath try this alsoSelect cast(convert (varchar(12), getdate(),101) as Datetime )
You dont need double convertions. Read previous repliesMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|
|
|