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 |
nheijmink
Starting Member
8 Posts |
Posted - 2008-01-09 : 14:45:54
|
Hii'am just an beginner with sqlbut can sombody tell me how to select a month out of a datetime?tnks |
|
russell
Pyro-ma-ni-yak
5072 Posts |
Posted - 2008-01-09 : 15:29:48
|
SELECT DatePart(month, YourDateField) FROM YourTable |
|
|
nheijmink
Starting Member
8 Posts |
Posted - 2008-01-09 : 15:37:15
|
tnks i tought there was also something like datetime.month or month(datetime) this becouse i am using this sql in vba code. |
|
|
rmiao
Master Smack Fu Yak Hacker
7266 Posts |
Posted - 2008-01-09 : 23:26:41
|
There is month() function in t-sql. |
|
|
sshelper
Posting Yak Master
216 Posts |
Posted - 2008-01-09 : 23:45:33
|
If you want to get the name of the month instead the month number, you can use the DATENAME function:select datename(mm, getdate())SQL Server Helperhttp://www.sql-server-helper.com |
|
|
|
|
|