Printed 2017/07/26 03:16PM

Why Format TSQL?

By Andy Warren, 2008/06/29

Recently I had the chance to help a student debug a problem on a production server. It appeared to be failing because duplicate uniqueidentifiers were being created. Thinking that unlikely because the G in GUID stands for global, we dug in but found the code painfully hard to follow due to poor formatting, mainly the indents. She didn't own one of those 'prettifier' tools, so we used my old standby Instant SQL Formatter, an online formatter that does a reasonable job of formatting TSQL at a great price - free! Note: I have no ownership or other interest in the site. Many scoff at making code pretty, but especially with a tool to do it for you it can really make life easier for the next person.

And the answer to the problem? The GUIDS were fine, there was a fall through case that had an incorrect error message, and that in turn was being caused by a data problem.

Copyright © 2002-2017 Redgate. All Rights Reserved. Privacy Policy. Terms of Use. Report Abuse.