treat `GO` as `;` if transactsql and split lines
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 behavior
set
ansi_nulls on
go
set
quoted_identifier on
go
create procedure aspDoSomething @pStartSerialNo varchar(20),
@pEndSerialNo varchar(20) as begin
-- code goes here
select
1;
end
go
-- desired behavior
set
ansi_nulls on
go -- line break after go
set
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)
as
begin
-- code goes here
select
1;
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)
OK. Thanks.
Basically should format GO on separate line (like now) and add an additional line break after it.
yeah, i am pretty sure the keyword GO is only used in TSQL too (maybe that makes a difference?)
thank you @nene