How do you calculate the last day of the month from the date value

advertisements

Possible Duplicate:
How do I calculate the last day of the month in SQL?

New to SQL, but how would you determine the last day of the month value from datetime (trans_date).

Sorry just a dumb question, but rather than using current date can I specify a trans_date (date) from trans table


Pinal Dave has a good explanation here:
http://blog.sqlauthority.com/2007/08/18/sql-server-find-last-day-of-any-month-current-previous-next/

Keep in mind that if you're using SQL2008 you can CAST( field AS DATE) to get rid of the resulting time data.