September 9, 2003 at 4:54 am
Can anyone help me out with a query that will give u the monthname like if i tell 1 then jan should be returned.
A query should give me this result.
Thanks
September 9, 2003 at 4:57 am
hi, check out the datename function in BOL :-
select datename(month,1)
returns January and so on, just change the number ...
HTH
Paul
September 9, 2003 at 5:41 am
Whatever month number is given it always returns only january
September 9, 2003 at 5:46 am
quote:
select datename(month,1)
there is a little typo is the above
the second parameter specifies from which date the monthname will be extracted
select datename(month,getdate())
------------------------------
September
(1 row(s) affected)
Frank
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]
September 9, 2003 at 5:53 am
What is happening in the first example is using a number like 1 is considered the number of days since 1/1/1970 so 1 is 1/2/1970 and 12 is 1/13/1970, all of which are January.
September 9, 2003 at 6:17 am
Thank you. I was able to achieve the result i wanted with this clue
September 10, 2003 at 8:39 am
You might also want to check out the 'datepart' command
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply