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 |
|
mykel_vykers
Starting Member
5 Posts |
Posted - 2010-01-28 : 00:29:39
|
| hi, how can i able to convert this date time '2010-01-28 11:39:19.687'('YYYYMMDD Time')to month 1 (January). tnx's. |
|
|
senthil_nagore
Master Smack Fu Yak Hacker
1007 Posts |
Posted - 2010-01-28 : 00:31:41
|
| select datename(m,'2010-01-28 11:39:19.687')select month('2010-01-28 11:39:19.687')Senthil.C------------------------------------------------------[Microsoft][ODBC SQL Server Driver]Operation canceledhttp://senthilnagore.blogspot.com/ |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2010-01-28 : 01:08:22
|
[code]select dateadd(month, datediff(month, 0, your_date), 0)[/code] KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
mykel_vykers
Starting Member
5 Posts |
Posted - 2010-01-28 : 01:11:44
|
| sorry that is what i meant to do. i add a column MONTH using this scriptALTER TABLE sales2009ADD Month varchar(15)then i want that column display the month from the trans_date ('2010-01-28 11:39:19.687') convert it to number MONTH.example.January = 1February = 2March = 3etc...what script should i use to able to convert it and show it appear to MONTH column that i made. |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2010-01-28 : 01:24:23
|
[code]datepart(month, your_date)[/code] KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
mykel_vykers
Starting Member
5 Posts |
Posted - 2010-01-28 : 01:38:51
|
| tnx's got it solve this is what i use.update sales2009set month = MONTH(doc_date)tnx's... |
 |
|
|
|
|
|