TaoK / PoorMansTSqlFormatter

A small free .Net and JS library (with demo UI, command-line bulk formatter, SSMS/VS add-in, notepad++ plugin, winmerge plugin, and demo webpage) for reformatting and coloring T-SQL code to the user's preferences.
http://www.architectshack.com/PoorMansTSqlFormatter.ashx
GNU Affero General Public License v3.0
964 stars 267 forks source link

DROP PROCEDURE IF EXISTS causes error parsing #268

Open djfoxer opened 3 years ago

djfoxer commented 3 years ago

DROP PROCEDURE IF EXISTS dbo.Procedure

causes dialog:

Errors found. Continue? Errors found during SQL parsing. Would you like to apply formatting anyway? Yes No

sfabrey commented 3 years ago

Same with Tables, Views, etc.

If you click "Yes" it puts a couple line breaks before the "IF"

MisterZeus commented 3 years ago

That may be because the "DROP object IF EXISTS" trick is specific to Microsoft SQL Server, it's not ANSI Standard T-SQL.