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
 Pull month from date field

Author  Topic 

twhit67
Starting Member

1 Post

Posted - 2010-04-21 : 13:22:27
I have 2 fields in my form;
1) date_of_report field (example entry: date is entered as 020228)
2) month field ( need a cleartext of the date: example February )

How do I pull the month from date_of_report and post the cleartext month name to my month field?

pk_bohra
Master Smack Fu Yak Hacker

1182 Posts

Posted - 2010-04-21 : 13:38:56
Converting the format:
declare @Test varchar(50)
set @Test = '020228'
select datename(mm, convert(datetime,@Test,120))

Update :

Update yourtable set month_field = datename(mm, convert(datetime,@Test,120))
Go to Top of Page
   

- Advertisement -