Here's a tip for bloggers (or anyone else) who use third party tools to convert T-SQL code into a publishing friendly format…
Yesterday I posted scripts to identify overlapping statistics and I used a tool to convert the T-SQL into something that retained the formatting you'd see in Management Studio. This morning I received an email from a keen-eyed reader who brought a misspelling to my attention. Of course I had checked my code before I used the tool but not after, and sure enough it had added an extra letter into one table alias in the script. Here's what it looked like before and after formatting was applied:

So today's lesson: Trust, but verify. Even if you check that your code works before you apply formatting make sure to copy it back to Management Studio afterwards and see that it still runs like you think it's supposed to.
(And for what it's worth I've fixed the error in the original blog post. If you copied the scripts yesterday you may want to revisit the post and copy them again)



Subscribe to this blog
Briefcase
Print
Posted by Martin Catherall on 6 April 2011
yes, a very good point. Ive spent a fair bit of time lately choosing a wordpress widget that will format my code nicely. I have never considered that the code may get changed - neither have I tested it after I've inserted it into the page, although I will now :)