You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CREATE OR ALTER VIEW Catalog.SomeView
WITHSCHEMABINDINGASSELECTt.IdAS TableId
FROMCatalog.Table1 t
WHEREt.LastModified=1GOCREATEUNIQUECLUSTEREDINDEX IX_SomeView_TableId ONCatalog.SomeView (TableId);
Expected Output
CREATE OR ALTER VIEW Catalog.SomeView
WITHSCHEMABINDINGASSELECTt.IdAS TableId
FROMCatalog.Table1 t
WHEREt.LastModified=1GOCREATEUNIQUECLUSTEREDINDEX IX_SomeView_TableId ONCatalog.SomeView (TableId);
CREATE OR ALTER VIEW Catalog.SomeView
WITHSCHEMABINDINGASSELECTt.IdAS TableId
FROMCatalog.Table1 t
WHEREt.LastModified=1GOCREATEUNIQUECLUSTEREDINDEX IX_SomeView_TableId ONCatalog.SomeView (TableId);
Usage
How are you calling / using the library? prettier-plugin-sql
What SQL language(s) does this apply to? tsql
Which SQL Formatter version are you using? 15.4.8
The text was updated successfully, but these errors were encountered:
It seems that the support of Transact-SQL is really very problematic. Somebody contributed this long-long time ago, and looks like he simply copy-pasted the titles from documentation and declared it as syntax.
I patched this specific bug, but there are countless more like this. If you're really interested in improving the Transact-SQL support, I suggest you take a look at this list and replace it with syntax for beginnings of actual statements. Like currently it contains:
Well, AGGREGATE and APPLICATION ROLE are probably the least interesting this. It doesn't support much more important stuff like CREATE {DATABASE|TRIGGER|SCHEMA|FUNCTION...}.
Input data
Which SQL and options did you provide as input?
Expected Output
or something similar. I believe it is reasonable to have
GO
at least on a separate line.It signals the end of a batch of tsql statements, see https://learn.microsoft.com/en-us/sql/t-sql/language-elements/sql-server-utilities-statements-go?view=sql-server-ver16
Actual Output
Usage
prettier-plugin-sql
tsql
15.4.8
The text was updated successfully, but these errors were encountered: