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 2000 Forums
 Transact-SQL (2000)
 Month

Author  Topic 

chiragkhabaria
Master Smack Fu Yak Hacker

1907 Posts

Posted - 2005-05-25 : 11:33:51
Hi All,

This any way, to convert the mmm into mm type.

for eg i have the stored proc in which i am passing the month as varchar i.e "January"... and within the stored procedure i want to convert it into MM type i.e 1 should come.

hoping for guidance. ..

Thanks and Regards

Chirag

Complicated things can be done by simple thinking

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2005-05-25 : 11:47:55
I don't like the sound of what you are doing, but if @Month is the varchar with "January", "February", etc, then something like:

Select Month(Convert(datetime, @Month + ' 1, 2000')) as MonthNumber

- Jeff
Go to Top of Page

chiragkhabaria
Master Smack Fu Yak Hacker

1907 Posts

Posted - 2005-05-26 : 02:30:20
Thanks Jeff
i was trying to do the same.. i some how was able to do that by using this
Select @pMonth = Month(Convert(Smalldatetime,'' + @pMonthChar + '01,1900',102))

its similar to you code, just little bit lenghty...

Thanks once again

Complicated things can be done by simple thinking
Go to Top of Page
   

- Advertisement -