Friday, May 11, 2012
So crazy, it just might work
Ever since I got into computers professionally, I've been about extending the tools that were available in order to make complex behavior easy. Back when I did perl (still a guilty pleasure and go to for quick text parsing), I wrote a couple of libraries for internal use that treated a non-newline delimited file format as though it were newline delimited. I suppose that bears a little more explanation. The format in question began every line with a two byte header that said how long the line was. The idea being that since the computer didn't have to seek to find the end of the line. Premature optimization perhaps, but it's what we had. So as a support guy, I'd typically have to "fix" files that got bogus data in them by whatever mechanism. Since most (if not all) tools at my disposal treated the notion of a line as a newline delimited one, I had to come up with something different. The details are a bit fuzzy now, but perl allows you to create code that overrides the typical semantics of any data type in the language. Since filehandles were included in that, I wrote code to treat lines how they were supposed to be treated. Which allowed me to get on with my life. Fast forward to today. I was recently doing some one-off reporting for the business and thought "man... a treemap would be a really great way to present this data". But alas, I didn't find an easy way to do this in SSRS or otherwise. But I've been doing some thinking and CLR is kind of the glue that allows one to extend SQL Server. So I got to thinking that perhaps CLR aggregate function could be written that leverages the geometry data type to do what needs doing. I'm no C# wizard by any means, but I think I'm going to start tinkering and see what I can do.