| Author |
Topic |
|
Ali T
Starting Member
22 Posts |
Posted - 2008-07-17 : 11:30:37
|
| Dear all;I have a table in sql server which contains a datetime column by the name of [datetime]. in this column i have both date and time as is clear. now i want to extract only the date part of this column and put it in a new column [date]. How can i handle this issue? please help me with this. Kind regardsAli T |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-07-17 : 11:38:33
|
| use UPDATE Table SET [date]=DATEADD(d,DATEDIFF(d,0,[datetime]),0) |
 |
|
|
Ali T
Starting Member
22 Posts |
Posted - 2008-07-17 : 12:14:59
|
quote: Originally posted by visakh16 use UPDATE Table SET [date]=DATEADD(d,DATEDIFF(d,0,[datetime]),0)
Dear visakh16I checked it but unfortunately it did not work. Anyway i'm really thankful and waiting for more guides from you.Ali T |
 |
|
|
elancaster
A very urgent SQL Yakette
1208 Posts |
Posted - 2008-07-17 : 12:20:20
|
| what do you mean when you say it didn't work? if you mean you found that it still had the time but all 00:00:00.000 then it did workEm |
 |
|
|
Ali T
Starting Member
22 Posts |
Posted - 2008-07-17 : 12:34:17
|
quote: Originally posted by elancaster what do you mean when you say it didn't work? if you mean you found that it still had the time but all 00:00:00.000 then it did workEm
Dear friendsI checked it once again and found my mistake. it worked and I am really thankful!wow!Ali T |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-07-17 : 12:34:17
|
quote: Originally posted by Ali T
quote: Originally posted by visakh16 use UPDATE Table SET [date]=DATEADD(d,DATEDIFF(d,0,[datetime]),0)
Dear visakh16I checked it but unfortunately it did not work. Anyway i'm really thankful and waiting for more guides from you.Ali T
why do you think it didnt work? Can you explain? |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-07-17 : 12:34:49
|
quote: Originally posted by Ali T
quote: Originally posted by elancaster what do you mean when you say it didn't work? if you mean you found that it still had the time but all 00:00:00.000 then it did workEm
Dear friendsI checked it once again and found my mistake. it worked and I am really thankful!wow!Ali T
cool |
 |
|
|
Ali T
Starting Member
22 Posts |
Posted - 2008-07-17 : 12:37:26
|
quote: Originally posted by visakh16
quote: Originally posted by Ali T
quote: Originally posted by visakh16 use UPDATE Table SET [date]=DATEADD(d,DATEDIFF(d,0,[datetime]),0)
Dear visakh16I checked it but unfortunately it did not work. Anyway i'm really thankful and waiting for more guides from you.Ali T
why do you think it didnt work? Can you explain?
Dear visakh16Thank you so much. that was my mistake. your quary was perfect.Thanks againAli T |
 |
|
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2008-07-17 : 12:38:53
|
quote: Originally posted by Ali T
quote: Originally posted by visakh16
quote: Originally posted by Ali T
quote: Originally posted by visakh16 use UPDATE Table SET [date]=DATEADD(d,DATEDIFF(d,0,[datetime]),0)
Dear visakh16I checked it but unfortunately it did not work. Anyway i'm really thankful and waiting for more guides from you.Ali T
why do you think it didnt work? Can you explain?
Dear visakh16Thank you so much. that was my mistake. your quary was perfect.Thanks againAli T
There is no quary in SQL Server |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-07-18 : 04:42:10
|
<<There is no quary in SQL Server>>It was another mistake MadhivananFailing to plan is Planning to fail |
 |
|
|
|