SQL Server 2012 - Formating a timeline in @tableHTML Header

56 Views Asked by At

I´m new on this site and with SQL, so apologies for my humble question. I have written reports in SQL Server 2012 environment. The problem is, how get a dynamic timeline to work in the header of the report? Reports are run at the first and 16th day of a month.

The separate selects inside the header row are working, but I do not find a decent and informative solution for the header. The idea is to show the reported period dynamically, like '2017-02-01 - 2017-02-15'.

This code:

N'<H1>Timeline'+(select DATEADD(dd, 1, EOMONTH(getdate(), -1)))+'-'
  +(select DATEADD(dd, 15, EOMONTH(getdate(), -1)))+'</H1>'+

Causes an error:

Msg 402, Level 16, State 1, Line 11
The data types nvarchar and date are incompatible in the add operator.

0

There are 0 best solutions below