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
 General SQL Server Forums
 New to SQL Server Programming
 date problem

Author  Topic 

shezad
Starting Member

32 Posts

Posted - 2010-04-04 : 02:02:29
hi,

How can I do this I have one parameter which will give me
month numeric value like 12 now I want to print Dec

for example SELECT DATENAME(month, getdate()) AS 'Month Name'
it will return current month
but in place of getdate I want to put 12 any idea

Regards
Shezad

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-04-04 : 02:07:35
something like below

DECLARE @month int

SET @month=12--your passed value

SELECT DATENAME(mm,DATEADD(mm,@month-1,0)) AS yourMonthNameValue


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

shezad
Starting Member

32 Posts

Posted - 2010-04-04 : 02:10:15
thank you very much
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-04-04 : 02:14:22
welcome

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -