sql server - Get the last day of the month in SQL -


I have to meet in the form of a date in SQL, on the last day of the month. If I have the first day of the month, then I can do something like this:

  DATEADD (DAY, DATEADD (MONTH, '2009-05-01', 1), -1) < / Code> 

But does anyone know how it is normalized, can I get any date for the last day of the month?

This is my version; No string manipulation or casting is necessary, only one to each DATEADD , YEAR and MONTH function:

  announcement @ test date set @ test = gate-date () - or Select another date DATEADD (month, ((year (TTES) - 1900) * 12) + month (@ test), -1)  

Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -