I need a small script to get the current month name and current year. So as to create a unique batch to store statements. My preferred format is January2011 or Feb2011 whichever is easier to get. i.e. MonthYear
Asked
Active
Viewed 141 times
3 Answers
0
Have a look at the DATEPART function and combine that with finding the name of a month, this SO question/answer has information on doing that.
0
You can use the following:
select datename(month,getdate()) + cast(datepart(year,getdate()) as char(4))

JStead
- 1,710
- 11
- 12