Raastarr (11/15/2012)
Apologies that I keep posting but I have just amended part of the ISNULL section toDATEADD(DD,DATEDIFF(DD,0,GETDATE()),3650))
and this now allows me to extend the working pattern forwards, as I am still not fully understanding all of the
code would someone be able to confirm that this is correct?
for simplicity i used todays date however you could change the second part of the ISNULL to @EndData or a constant which would probably work better than modifying the DATEADD in the manner you have.
Remember if you dont understand the code please dont put it in production, your the one who will have to support the application in the future and if something breaks you will need to know how to fix it.
For performance Issues see how we like them posted here: How to Post Performance Problems - Gail Shaw[/url]
Need to Split some strings? Jeff Moden's DelimitedSplit8K[/url]
Jeff Moden's Cross tab and Pivots Part 1[/url]
Jeff Moden's Cross tab and Pivots Part 2[/url]