SQL Clone
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in

Why Format TSQL?

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.


I'm Andy Warren, currently a SQL Server trainer with End to End Training. Over the past few years I've been a developer, DBA, and IT Director. I was one of the original founders of SQLServerCentral.com and helped grow that community from zero to about 300k members before deciding to move on to other ventures.


No comments.

Leave a Comment

Please register or log in to leave a comment.