Workaround procedure for http://technet.microsoft.com/de-de/library/ee634239.aspx
CREATE VIRTUAL PROCEDURE views.endofmonth( IN getdate date ) returns (outdate date) asBEGIN DECLARE date monthlater = timestampadd( SQL_TSI_MONTH, 1, getdate ); select timestampadd( SQL_TSI_DAY, - dayofmonth(monthlater), monthlater);END;; |
Usage Examples
call views.endofmonth( cast ( '2012-02-07' as date ) )result: 2012-02-29call endofmonth( current_date )result: Last day of current monthusing in WHERE clauseSELECT foo from table.bar WHERE column = ( call endofmonth( current_date ) ) |
Comments
0 comments
Please sign in to leave a comment.