Adding SQL Code Highlighter to Reporting Services using VB

Having created a rudimentary audit of DDL changes to SQL Server, I wanted to be able to quickly look at the changes through SSMS. To do this, I added a custom report on the object explorer right click menu that just queryed the audit data against the particular function/procedure etc. This just makes it very quick and easy to see what has changed and when (particularly if you don’t have source control on your SQL Server Database!)

That was all easy enough, but then to make those long procedures a bit easier to read I thought it would be good to get some code highlighting involved. I can’t install a custom assembly on the server, so I had to find another way. Fortunately, this is relatively simple(ish!) using a placeholder, inserting a text object, and creating a code element in the report to pass the TSQL to for formatting.

I’m sure there is room for improvement (I particularly don’t like removing then re-adding the code comments, there must be nice regex way to do this!), but it seems to do the job OK so it’s a good start!


Leave a Reply

Your email address will not be published.