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
If the language is TSQL, it is frequent that GO will be used instead of ;, especially in stored procedures, so it would be nice to have the option to set line splitters (maybe call them something better?) other then just ;, possible even comments could be, but for now this would be really nice in formatting the SQL to be prettier
I'm not really sure I understand how you expect this to work. It would be better if you gave an example. Like how does SQL Formatter print GO right now and how would you like it to be treated instead?
-- current behaviorset
ansi_nulls on
go
set
quoted_identifier on
go
create procedure aspDoSomething @pStartSerialNo varchar(20),
@pEndSerialNo varchar(20) asbegin-- code goes hereselect1;
end
go
-- desired behaviorset
ansi_nulls on
go -- line break after goset
quoted_identifier on
go -- line break after go
create procedure aspDoSomething -- not in this issue but would be nice to split parameters of stored procedures and indent them, but thats a separate topic
@pStartSerialNo varchar(20),
@pEndSerialNo varchar(20)
asbegin-- code goes hereselect1;
end
go -- line break after go
you cannot put GO with ; in a stored procedure file before create procedure x because it needs to be the first statement in a query (silly clause i know but thats SQL Server)
Well, there's currently no real way to add a formatting rule for a specific dialect. So editing that file is probably not much help.
One likely needs to modify the ExpressionFormatter to add a special formatting for the GO keyword. Though it likely makes sense to do special classification of the GO keyword, so it's only detected in case of TransactSQL.
Activity
nene commentedon Oct 24, 2025
I'm not really sure I understand how you expect this to work. It would be better if you gave an example. Like how does SQL Formatter print GO right now and how would you like it to be treated instead?
bobbymannino commentedon Oct 24, 2025
you cannot put
GOwith;in a stored procedure file beforecreate procedure xbecause it needs to be the first statement in a query (silly clause i know but thats SQL Server)nene commentedon Oct 24, 2025
OK. Thanks.
Basically should format
GOon separate line (like now) and add an additional line break after it.bobbymannino commentedon Oct 24, 2025
yeah, i am pretty sure the keyword
GOis only used in TSQL too (maybe that makes a difference?)thank you @nene
kkum commentedon Jul 21, 2026
Hello thanks for this library,
I have the same request as i get errors for how the formatting works,
here is my config
Here is what i expect
Here is what i get
Note the
go dropon line 6 that is no valid sqlI'd be happy to send a PR, can you just point the main file where this could be handled ?
thanks
bobbymannino commentedon Jul 22, 2026
@kkum i think it would be handled within https://github.com/sql-formatter-org/sql-formatter/blob/master/src/languages/transactsql/transactsql.formatter.ts
nene commentedon Jul 23, 2026
Well, there's currently no real way to add a formatting rule for a specific dialect. So editing that file is probably not much help.
One likely needs to modify the ExpressionFormatter to add a special formatting for the
GOkeyword. Though it likely makes sense to do special classification of theGOkeyword, so it's only detected in case of TransactSQL.