Monday, September 29, 2014

SQL Syntax Formatter


Of course you have choices!


My choice is to keep the code readable and free from noise, and when a new version of SQL Server introduces a new reserved keyword that clashes with an identifier I have, I take the hit in this case. After all, as long as your code is all stored procedures with no or a limited amount of dynamic SQL, finding these issues is a matter of rebuilding the database and track the compilation errors.


Microsoft are very conservative with adding new reserved keywords, a little too conservative in my opinion. For instance, SQL 2012 introduced the THROW statement, but they did not make THROW a reserved keyword and this introduced some funky behaviour.


SQL 2005 introduced a number of new reserved keywords. But since SQL 2008 and on, the only new reserved keyword I can recall is MERGE, but I may have overlooked one or two.





Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Thanks, we still prefer the square brackets to avoid the compatibility issue in the future.


No comments:

Post a Comment