Monday, May 21, 2007

SQL query to get Month Name for today

I wanted to insert the month name of the current date into a table using a SQL query.

I first thought that I could achieve this by simply using the monthname function. But when I typed that in the SQL Query analyser, the error made me realise that it is not that easy to get the result I want.

So in the end here is what I came up with:

select datename(month, getdate())+'-'+ convert(varchar,year(getdate())) as Month_

No comments:

Step By Step Guide to resolve SQL server connection issues when connecting from R Studio

Yesterday I tried using a couple of  RevolveScaleR functions -- RxSqlServerData and Rstudio.  These are my learnings as part of ...