Write the query to find the EOM(End of Month) given the start date (or any date) of a month?

 Posted by Niladri.Biswas on 7/19/2012 | Category: Sql Server Interview questions | Views: 1299 | Points: 40
Answer:

DECLARE @date varchar(10) 

SET @date = '6/12/2012' -- mm/dd/yyyy
SELECT EOM = DATEADD(month, ((YEAR(@date) - 1900) * 12) + MONTH(@date), -1)


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response