Closed
Description
Input data
SET
NOCOUNT ON;
GO
CREATE OR ALTER PROCEDURE dbo.sp_say_hi (@Name VARCHAR(25) = 'World')
AS BEGIN
PRINT CONCAT('Hello, ', @Name);
END;
Expected Output
SET
NOCOUNT ON;
GO
CREATE
OR ALTER
PROCEDURE dbo.sp_say_hi (@Name VARCHAR(25) = 'World')
AS BEGIN
PRINT CONCAT('Hello, ', @Name);
END;
The GO
statement should be on it's own line.
Actual Output
SET
NOCOUNT ON;
GO CREATE
OR ALTER
PROCEDURE dbo.sp_say_hi (@Name VARCHAR(25) = 'World') AS BEGIN
PRINT CONCAT('Hello, ', @Name);
END;
When executed on the database a fatal error occurs (Incorrect syntax was encountered while CREATE was being parsed
) because of the GO
.
Usage
- How are you calling / using the library?
The library is being called from a Git hook with the below config:{ "language": "tsql", "tab width": 4, "useTabs": false, "keywordCase": "upper", "indentStyle": "standard", "logicalOperatorNewline": "before", "expressionWidth": 80, "linesBetweenQueries": 2, "denseOperators": false, "newlineBeforeSemicolon": false }
- What SQL language(s) does this apply to?
Transact-SQL/T-SQL - Which SQL Formatter version are you using?
Latest (v12.2.2
)