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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Current Month from Date

Author  Topic 

GeoffreyP
Starting Member

9 Posts

Posted - 2009-11-06 : 01:20:04
Select DATENAME(month,(Month(getdate())))

The above gives the result January when one expects to get November

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2009-11-06 : 01:29:30
I have already given the solution in your previous thread!


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

GeoffreyP
Starting Member

9 Posts

Posted - 2009-11-06 : 01:33:31
Thanks did not check prior thread this morning
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-11-06 : 03:00:07
quote:
Originally posted by GeoffreyP

Select DATENAME(month,(Month(getdate())))

The above gives the result January when one expects to get November


It is becuae, you are taking month number instead of actual date
It should be

Select DATENAME(month,getdate())


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -