| Author |
Topic  |
|
|
sanjnep
Posting Yak Master
USA
175 Posts |
Posted - 10/31/2007 : 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?
Thanks Sanjeev |
|
|
dinakar
Flowing Fount of Yak Knowledge
USA
2347 Posts |
Posted - 10/31/2007 : 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
196 Posts |
Posted - 10/31/2007 : 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 Helper http://www.sql-server-helper.com |
 |
|
|
sanjnep
Posting Yak Master
USA
175 Posts |
Posted - 10/31/2007 : 13:29:49
|
| Thanks a lot......... |
 |
|
|
madhivanan
Premature Yak Congratulator
India
20644 Posts |
|
|
ranganath
Posting Yak Master
209 Posts |
Posted - 11/02/2007 : 02:19:21
|
try this also
Select cast(convert (varchar(12), getdate(),101) as Datetime ) |
 |
|
|
madhivanan
Premature Yak Congratulator
India
20644 Posts |
Posted - 11/02/2007 : 03:03:35
|
quote: Originally posted by ranganath
try this also
Select cast(convert (varchar(12), getdate(),101) as Datetime )
You dont need double convertions. Read previous replies
Madhivanan
Failing to plan is Planning to fail |
 |
|
| |
Topic  |
|