How can I get the month number in sql? I use the following code but it returns the month name.
SELECT DATENAME(mm, GETDATE())
Try the below:
SELECT DATEPART(mm,getdate())