Database Simplified Headline Animator

Database Simplified

Saturday 1 October 2011

Finding Last Day Of Month In SQL Server Denali (MSSQL2012)

Calculating Last Day of Month For Any Given Date Has become more easy as EOMONTH (End Of Month) function has been introduced in SQL Server Denali (MSSQL 2011).

How ? See Following

Syntax :


EOMONTH ( start_date [, month_to_add ] )

Month_to_Add : This is Optional Parameter.


Select GetDate()As InputDate,EOMONTH (GETDATE()) As Result

Output:

image

How to Find Last Day Of Previous Month


Select GetDate()As InputDate,EOMONTH (GETDATE(),-1) As Result

image

So You Just Need To Add Optional Parameter Number_of_Month So To Get Previous Month Last Date I have Added –1 To Optional Parameter. To Get Desired Month Last Date You Can Pass No_Of_Month Parameter.

See Following Screen Shot

image

1 comment:

  1. You can withdraw together with your alternative of account method and it will go through. You want to|might need to} go to the banking part or account at a quick paying on line casino to request a withdrawal. The subsequent step is to decide on} how much to withdraw and what method. It is necessary that you just look past the headline-grabbing quantity to know what wagering requirements this bonus has. It's much more durable to finish a bonus with a 65x requirement versus one with a 카지노사이트 minimum of 20x. If we now have to call customer service, we want them polite, friendly, environment friendly, useful, and available always, through many different media.

    ReplyDelete