Repository: sqlfluff/sqlfluff
Pull request: TSQL - BEGIN/END blocks
### Brief summary of the change made
Fixes #1555 

Adding BEGIN/END blocks to TSQL. This will improve our parsing of stored procedures, and lay the foundation for properly parsing IF/ELSE statements and functions.

In order to support BEGIN/END blocks, I'm introducing a new segment called the BatchSegment.  A batch is bounded by GO statement segments within a FileSegment, or wrapped within BEGIN/END within a BeginEndSegment.

I'm overriding FileSegment in order to incorporate this new BatchSegment.  Now, instead of being a delimited set of StatementSegments, a FileSegment is a delimited set of BatchSegments.  A new delimiter segment called BatchDelimiterSegment now exists to perform this delimitation.  The standard delimiter segment has had GO removed from its definition; the segment and its delimitation have been pushed down one level to within BatchSegment.

Because of these changes, the StatementSegment's GreedyUntil match logic no longer works.  Instead, we are moving the parser logic to the match logic.

We are also overriding TransactionSegment now in order to allow the parser to easily distinguish between it and a BEGIN/END block.  In TSQL, a Transaction must start with "BEGIN TRANSACTION" and not just "BEGIN", likely for the same distinguishing purpose.

I have added TSQL test cases begin_end_nested.sql, stored_procedure_begin_end.sql and transaction.sql.

As a result of the new BatchSegment layer under FileSegment, all test case parser YMLs have been updated to include a batch layer. "Use Hide whitespace changes: when reviewing to make ths the changes more obvious:

![image](https://user-images.githubusercontent.com/10931297/136508766-4116fe6c-3b27-45e0-94b8-8852f575fd09.png)


### Are there any other side effects of this change that we should be aware of?
T-SQL now no longer as a quick `GreedyUntil` `match_grammar` option so will be slightly slower. But this is necessary as semi-colons are used within statements.

### Pull Request checklist
- [x] Please confirm you have completed any of the necessary steps below.

- Included test cases to demonstrate any code changes, which may be one or more of the following:
  - `.yml` rule test cases in `test/fixtures/rules/std_rule_cases`.
  - `.sql`/`.yml` parser test cases in `test/fixtures/parser` (note YML files can be auto generated with `python test/generate_parse_fixture_yml.py` or by running `tox` locally).
  - Full autofix test cases in `test/fixtures/linter/autofix`.
  - Other.
- Added appropriate documentation for the change.
- Created GitHub issues for any relevant followup/future enhancements if appropriate.


Problem statement:
TSQL: Incorrect indent in if block
Example code:
```sql
if @debug = 1
  begin
    print '<something>';
    print '<something else>';
    return
  end
```

## Expected Behaviour
The indentation is correct like this.

## Observed Behaviour
The third line (`print '<something else>';`) is de-indented to the same level as line 1.

## Steps to Reproduce
see above

## Dialect
tsql

## Version
sqlfluff version 0.6.8, Python 3.10.0

## Configuration
none

Hints from issue discussion:

Commit message: BEGIN/END

Patch to review:
diff --git a/src/sqlfluff/dialects/dialect_tsql.py b/src/sqlfluff/dialects/dialect_tsql.py
index 2fada2a91e2..6cfa44027a3 100644
--- a/src/sqlfluff/dialects/dialect_tsql.py
+++ b/src/sqlfluff/dialects/dialect_tsql.py
@@ -21,6 +21,7 @@
     OptionallyBracketed,
     Dedent,
     AnyNumberOf,
+    BaseFileSegment,
 )
 
 from sqlfluff.core.dialects import load_raw_dialect
@@ -57,6 +58,7 @@
     BracketedIdentifierSegment=NamedParser(
         "square_quote", CodeSegment, name="quoted_identifier", type="identifier"
     ),
+    BatchDelimiterSegment=Ref("GoStatementSegment"),
     QuotedLiteralSegmentWithN=NamedParser(
         "single_quote_with_n", CodeSegment, name="quoted_literal", type="literal"
     ),
@@ -65,11 +67,7 @@
 tsql_dialect.replace(
     # Below delimiterstatement might need to be removed in the future as delimiting
     # is optional with semicolon and GO is a end of statement indicator.
-    DelimiterSegment=OneOf(
-        Sequence(Ref("SemicolonSegment"), Ref("GoStatementSegment")),
-        Ref("SemicolonSegment"),
-        Ref("GoStatementSegment"),
-    ),
+    DelimiterSegment=Ref("SemicolonSegment"),
     SingleIdentifierGrammar=OneOf(
         Ref("NakedIdentifierSegment"),
         Ref("QuotedIdentifierSegment"),
@@ -118,9 +116,8 @@
 class StatementSegment(ansi_dialect.get_segment("StatementSegment")):  # type: ignore
     """Overriding StatementSegment to allow for additional segment parsing."""
 
-    parse_grammar = ansi_dialect.get_segment("StatementSegment").parse_grammar.copy(
+    match_grammar = ansi_dialect.get_segment("StatementSegment").parse_grammar.copy(
         insert=[
-            Ref("CreateProcedureStatementSegment"),
             Ref("IfExpressionStatement"),
             Ref("DeclareStatementSegment"),
             Ref("SetStatementSegment"),
@@ -131,6 +128,8 @@ class StatementSegment(ansi_dialect.get_segment("StatementSegment")):  # type: i
         ],
     )
 
+    parse_grammar = match_grammar
+
 
 @tsql_dialect.segment(replace=True)
 class SelectClauseModifierSegment(BaseSegment):
@@ -612,7 +611,6 @@ class CreateProcedureStatementSegment(BaseSegment):
         Ref("ObjectReferenceSegment"),
         Ref("FunctionParameterListGrammar", optional=True),
         "AS",
-        # Pending to add BEGIN END optional
         Ref("ProcedureDefinitionGrammar"),
     )
 
@@ -624,7 +622,10 @@ class ProcedureDefinitionGrammar(BaseSegment):
     type = "procedure_statement"
     name = "procedure_statement"
 
-    match_grammar = Ref("StatementSegment")
+    match_grammar = OneOf(
+        Ref("StatementSegment"),
+        Ref("BeginEndSegment"),
+    )
 
 
 @tsql_dialect.segment(replace=True)
@@ -981,3 +982,82 @@ class DatePartClause(BaseSegment):
         "YY",
         "YYYY",
     )
+
+
+@tsql_dialect.segment(replace=True)
+class TransactionStatementSegment(BaseSegment):
+    """A `COMMIT`, `ROLLBACK` or `TRANSACTION` statement."""
+
+    type = "transaction_statement"
+    match_grammar = OneOf(
+        # BEGIN | SAVE TRANSACTION
+        # COMMIT [ TRANSACTION | WORK ]
+        # ROLLBACK [ TRANSACTION | WORK ]
+        # https://docs.microsoft.com/en-us/sql/t-sql/language-elements/begin-transaction-transact-sql?view=sql-server-ver15
+        Sequence(
+            "BEGIN",
+            Sequence("DISTRIBUTED", optional=True),
+            "TRANSACTION",
+            Ref("SingleIdentifierGrammar", optional=True),
+            Sequence("WITH", "MARK", Ref("QuotedIdentifierSegment"), optional=True),
+        ),
+        Sequence(
+            OneOf("COMMIT", "ROLLBACK"), OneOf("TRANSACTION", "WORK", optional=True)
+        ),
+        Sequence("SAVE", "TRANSACTION"),
+    )
+
+
+@tsql_dialect.segment(replace=True)
+class FileSegment(BaseFileSegment):
+    """A segment representing a whole file or script.
+
+    This is also the default "root" segment of the dialect,
+    and so is usually instantiated directly. It therefore
+    has no match_grammar.
+    """
+
+    # NB: We don't need a match_grammar here because we're
+    # going straight into instantiating it directly usually.
+    parse_grammar = Delimited(
+        Ref("BatchSegment"),
+        delimiter=Ref("BatchDelimiterSegment"),
+        allow_gaps=True,
+        allow_trailing=True,
+    )
+
+
+@tsql_dialect.segment()
+class BeginEndSegment(BaseSegment):
+    """A `BEGIN/END` block.
+
+    Encloses multiple statements into a single statement object.
+    https://docs.microsoft.com/en-us/sql/t-sql/language-elements/begin-end-transact-sql?view=sql-server-ver15
+    """
+
+    type = "begin_end_block"
+    match_grammar = Sequence(
+        "BEGIN",
+        Ref("BatchSegment"),
+        "END",
+    )
+
+
+@tsql_dialect.segment()
+class BatchSegment(BaseSegment):
+    """A segment representing a GO batch within a file or script."""
+
+    type = "batch"
+    match_grammar = OneOf(
+        AnyNumberOf(
+            Ref("BeginEndSegment"),
+            min_times=1,
+        ),
+        Ref("CreateProcedureStatementSegment"),
+        Delimited(
+            Ref("StatementSegment"),
+            delimiter=Ref("DelimiterSegment"),
+            allow_gaps=True,
+            allow_trailing=True,
+        ),
+    )
diff --git a/test/fixtures/parser/tsql/add_index.yml b/test/fixtures/parser/tsql/add_index.yml
index 3248fdfada5..474c9e96bc6 100644
--- a/test/fixtures/parser/tsql/add_index.yml
+++ b/test/fixtures/parser/tsql/add_index.yml
@@ -3,169 +3,172 @@
 # computed by SQLFluff when running the tests. Please run
 # `python test/generate_parse_fixture_yml.py`  to generate them after adding or
 # altering SQL files.
-_hash: 81a26b0b96e68c16d92f9c038f7d5adba68dddb17b7c24a85927a4ae91f4608f
+_hash: 61e2ef0df4ef74ad5ac34cd48276f3ea78e4ac2ddaac2921182bf4a4df54d139
 file:
-- statement:
-    if_then_statement:
-      keyword: IF
-      statement:
-        if_then_statement:
-          expression:
-          - keyword: NOT
-          - keyword: EXISTS
-          - bracketed:
-              start_bracket: (
-              expression:
-                select_statement:
-                  select_clause:
-                    keyword: SELECT
-                    select_clause_element:
-                      wildcard_expression:
-                        wildcard_identifier:
-                          star: '*'
-                  from_clause:
-                    keyword: FROM
-                    from_expression:
-                      from_expression_element:
-                        table_expression:
-                          table_reference:
-                          - identifier: sys
-                          - dot: .
-                          - identifier: indexes
-                  where_clause:
-                    keyword: WHERE
-                    expression:
-                      column_reference:
-                        identifier: NAME
-                      comparison_operator: '='
-                      literal: "'IX_INTER_VIMR_INFECTIOUS_PEOPLE'"
-              end_bracket: )
-          statement:
-            create_index_statement:
-            - keyword: CREATE
-            - keyword: NONCLUSTERED
-            - keyword: INDEX
-            - index_reference:
-                identifier: IX_INTER_VIMR_INFECTIOUS_PEOPLE
-            - keyword: 'ON'
-            - table_reference:
-              - identifier: dbo
-              - dot: .
-              - identifier: VIMR_INFECTIOUS_PEOPLE
+- batch:
+    statement:
+      if_then_statement:
+        keyword: IF
+        statement:
+          if_then_statement:
+            expression:
+            - keyword: NOT
+            - keyword: EXISTS
             - bracketed:
                 start_bracket: (
-                index_column_definition:
-                  identifier: DATE_LAST_INSERTED
+                expression:
+                  select_statement:
+                    select_clause:
+                      keyword: SELECT
+                      select_clause_element:
+                        wildcard_expression:
+                          wildcard_identifier:
+                            star: '*'
+                    from_clause:
+                      keyword: FROM
+                      from_expression:
+                        from_expression_element:
+                          table_expression:
+                            table_reference:
+                            - identifier: sys
+                            - dot: .
+                            - identifier: indexes
+                    where_clause:
+                      keyword: WHERE
+                      expression:
+                        column_reference:
+                          identifier: NAME
+                        comparison_operator: '='
+                        literal: "'IX_INTER_VIMR_INFECTIOUS_PEOPLE'"
                 end_bracket: )
-- statement_terminator: ;
+            statement:
+              create_index_statement:
+              - keyword: CREATE
+              - keyword: NONCLUSTERED
+              - keyword: INDEX
+              - index_reference:
+                  identifier: IX_INTER_VIMR_INFECTIOUS_PEOPLE
+              - keyword: 'ON'
+              - table_reference:
+                - identifier: dbo
+                - dot: .
+                - identifier: VIMR_INFECTIOUS_PEOPLE
+              - bracketed:
+                  start_bracket: (
+                  index_column_definition:
+                    identifier: DATE_LAST_INSERTED
+                  end_bracket: )
+    statement_terminator: ;
 - go_statement:
     keyword: GO
-- statement:
-    if_then_statement:
-      keyword: IF
-      statement:
-        if_then_statement:
-          expression:
-          - keyword: NOT
-          - keyword: EXISTS
-          - bracketed:
-              start_bracket: (
-              expression:
-                select_statement:
-                  select_clause:
-                    keyword: SELECT
-                    select_clause_element:
-                      wildcard_expression:
-                        wildcard_identifier:
-                          star: '*'
-                  from_clause:
-                    keyword: FROM
-                    from_expression:
-                      from_expression_element:
-                        table_expression:
-                          table_reference:
-                          - identifier: sys
-                          - dot: .
-                          - identifier: indexes
-                  where_clause:
-                    keyword: WHERE
-                    expression:
-                      column_reference:
-                        identifier: NAME
-                      comparison_operator: '='
-                      literal: "'IX_INTER_FOUNDATION_NICE_IC_INTAKE_COUNT'"
-              end_bracket: )
-          statement:
-            create_index_statement:
-            - keyword: CREATE
-            - keyword: NONCLUSTERED
-            - keyword: INDEX
-            - index_reference:
-                identifier: IX_INTER_FOUNDATION_NICE_IC_INTAKE_COUNT
-            - keyword: 'ON'
-            - table_reference:
-              - identifier: dbo
-              - dot: .
-              - identifier: FOUNDATION_NICE_IC_INTAKE_COUNT
+- batch:
+    statement:
+      if_then_statement:
+        keyword: IF
+        statement:
+          if_then_statement:
+            expression:
+            - keyword: NOT
+            - keyword: EXISTS
             - bracketed:
                 start_bracket: (
-                index_column_definition:
-                  identifier: DATE_LAST_INSERTED
+                expression:
+                  select_statement:
+                    select_clause:
+                      keyword: SELECT
+                      select_clause_element:
+                        wildcard_expression:
+                          wildcard_identifier:
+                            star: '*'
+                    from_clause:
+                      keyword: FROM
+                      from_expression:
+                        from_expression_element:
+                          table_expression:
+                            table_reference:
+                            - identifier: sys
+                            - dot: .
+                            - identifier: indexes
+                    where_clause:
+                      keyword: WHERE
+                      expression:
+                        column_reference:
+                          identifier: NAME
+                        comparison_operator: '='
+                        literal: "'IX_INTER_FOUNDATION_NICE_IC_INTAKE_COUNT'"
                 end_bracket: )
-- statement_terminator: ;
+            statement:
+              create_index_statement:
+              - keyword: CREATE
+              - keyword: NONCLUSTERED
+              - keyword: INDEX
+              - index_reference:
+                  identifier: IX_INTER_FOUNDATION_NICE_IC_INTAKE_COUNT
+              - keyword: 'ON'
+              - table_reference:
+                - identifier: dbo
+                - dot: .
+                - identifier: FOUNDATION_NICE_IC_INTAKE_COUNT
+              - bracketed:
+                  start_bracket: (
+                  index_column_definition:
+                    identifier: DATE_LAST_INSERTED
+                  end_bracket: )
+    statement_terminator: ;
 - go_statement:
     keyword: GO
-- statement:
-    if_then_statement:
-      keyword: IF
-      statement:
-        if_then_statement:
-          expression:
-            keyword: EXISTS
-            bracketed:
-              start_bracket: (
-              expression:
-                select_statement:
-                  select_clause:
-                    keyword: SELECT
-                    select_clause_element:
-                      wildcard_expression:
-                        wildcard_identifier:
-                          star: '*'
-                  from_clause:
-                    keyword: FROM
-                    from_expression:
-                      from_expression_element:
-                        table_expression:
-                          table_reference:
-                          - identifier: sys
-                          - dot: .
-                          - identifier: indexes
-                  where_clause:
-                    keyword: WHERE
-                    expression:
-                      column_reference:
-                        identifier: NAME
-                      comparison_operator: '='
-                      literal: "'IX_INTER_VIMR_REPRODUCTION_NUMBER'"
-              end_bracket: )
-          statement:
-            create_index_statement:
-            - keyword: CREATE
-            - keyword: CLUSTERED
-            - keyword: INDEX
-            - index_reference:
-                identifier: IX_INTER_VIMR_REPRODUCTION_NUMBER
-            - keyword: 'ON'
-            - table_reference:
-              - identifier: dbo
-              - dot: .
-              - identifier: VIMR_INFECTIOUS_PEOPLE
-            - bracketed:
+- batch:
+    statement:
+      if_then_statement:
+        keyword: IF
+        statement:
+          if_then_statement:
+            expression:
+              keyword: EXISTS
+              bracketed:
                 start_bracket: (
-                index_column_definition:
-                  identifier: DATE_LAST_INSERTED
+                expression:
+                  select_statement:
+                    select_clause:
+                      keyword: SELECT
+                      select_clause_element:
+                        wildcard_expression:
+                          wildcard_identifier:
+                            star: '*'
+                    from_clause:
+                      keyword: FROM
+                      from_expression:
+                        from_expression_element:
+                          table_expression:
+                            table_reference:
+                            - identifier: sys
+                            - dot: .
+                            - identifier: indexes
+                    where_clause:
+                      keyword: WHERE
+                      expression:
+                        column_reference:
+                          identifier: NAME
+                        comparison_operator: '='
+                        literal: "'IX_INTER_VIMR_REPRODUCTION_NUMBER'"
                 end_bracket: )
-- statement_terminator: ;
+            statement:
+              create_index_statement:
+              - keyword: CREATE
+              - keyword: CLUSTERED
+              - keyword: INDEX
+              - index_reference:
+                  identifier: IX_INTER_VIMR_REPRODUCTION_NUMBER
+              - keyword: 'ON'
+              - table_reference:
+                - identifier: dbo
+                - dot: .
+                - identifier: VIMR_INFECTIOUS_PEOPLE
+              - bracketed:
+                  start_bracket: (
+                  index_column_definition:
+                    identifier: DATE_LAST_INSERTED
+                  end_bracket: )
+    statement_terminator: ;
 - go_statement:
     keyword: GO
diff --git a/test/fixtures/parser/tsql/alter_table_switch.yml b/test/fixtures/parser/tsql/alter_table_switch.yml
index f0a09e6a604..9358605a820 100644
--- a/test/fixtures/parser/tsql/alter_table_switch.yml
+++ b/test/fixtures/parser/tsql/alter_table_switch.yml
@@ -3,27 +3,28 @@
 # computed by SQLFluff when running the tests. Please run
 # `python test/generate_parse_fixture_yml.py`  to generate them after adding or
 # altering SQL files.
-_hash: e4dcf89409d1fb59f15905e9180b162da7dbe35646c5071f0244d723d2c9bba1
+_hash: d8f58ac5175eef5f909d671ebf6e7e66b7215fe034962a644eb8e68d56359ebd
 file:
-  statement:
-    alter_table_switch_statement:
-    - keyword: ALTER
-    - keyword: TABLE
-    - object_reference:
-      - identifier: '[Facility]'
-      - dot: .
-      - identifier: '[PL_stage]'
-    - keyword: SWITCH
-    - keyword: TO
-    - object_reference:
-      - identifier: '[Facility]'
-      - dot: .
-      - identifier: '[PL_BASE]'
-    - keyword: WITH
-    - bracketed:
-      - start_bracket: (
-      - keyword: TRUNCATE_TARGET
-      - comparison_operator: '='
-      - keyword: 'ON'
-      - end_bracket: )
-  statement_terminator: ;
+  batch:
+    statement:
+      alter_table_switch_statement:
+      - keyword: ALTER
+      - keyword: TABLE
+      - object_reference:
+        - identifier: '[Facility]'
+        - dot: .
+        - identifier: '[PL_stage]'
+      - keyword: SWITCH
+      - keyword: TO
+      - object_reference:
+        - identifier: '[Facility]'
+        - dot: .
+        - identifier: '[PL_BASE]'
+      - keyword: WITH
+      - bracketed:
+        - start_bracket: (
+        - keyword: TRUNCATE_TARGET
+        - comparison_operator: '='
+        - keyword: 'ON'
+        - end_bracket: )
+    statement_terminator: ;
diff --git a/test/fixtures/parser/tsql/begin_end_nested.sql b/test/fixtures/parser/tsql/begin_end_nested.sql
new file mode 100644
index 00000000000..953f715378e
--- /dev/null
+++ b/test/fixtures/parser/tsql/begin_end_nested.sql
@@ -0,0 +1,5 @@
+BEGIN
+	BEGIN
+		SELECT 'Weekend';
+	END
+END
diff --git a/test/fixtures/parser/tsql/begin_end_nested.yml b/test/fixtures/parser/tsql/begin_end_nested.yml
new file mode 100644
index 00000000000..35c9e20e2f4
--- /dev/null
+++ b/test/fixtures/parser/tsql/begin_end_nested.yml
@@ -0,0 +1,23 @@
+# YML test files are auto-generated from SQL files and should not be edited by
+# hand. To help enforce this, the "hash" field in the file must match a hash
+# computed by SQLFluff when running the tests. Please run
+# `python test/generate_parse_fixture_yml.py`  to generate them after adding or
+# altering SQL files.
+_hash: e461d59020dc2523ffd449438d7d8f7b7e808cb8bf84c3806d064ea3f72ffb5c
+file:
+  batch:
+    begin_end_block:
+    - keyword: BEGIN
+    - batch:
+        begin_end_block:
+        - keyword: BEGIN
+        - batch:
+            statement:
+              select_statement:
+                select_clause:
+                  keyword: SELECT
+                  select_clause_element:
+                    literal: "'Weekend'"
+            statement_terminator: ;
+        - keyword: END
+    - keyword: END
diff --git a/test/fixtures/parser/tsql/create_table.yml b/test/fixtures/parser/tsql/create_table.yml
index e49eb2b2b57..492c3b6241d 100644
--- a/test/fixtures/parser/tsql/create_table.yml
+++ b/test/fixtures/parser/tsql/create_table.yml
@@ -3,48 +3,49 @@
 # computed by SQLFluff when running the tests. Please run
 # `python test/generate_parse_fixture_yml.py`  to generate them after adding or
 # altering SQL files.
-_hash: 0e20e78dee5085d7fab3b8714a918b6ef1762425ed982323a957b8a03ceaf399
+_hash: 76359b225107f55f7a17fbae95a21bf0015395668c9a17ce276a17bca8a0093b
 file:
-  statement:
-    create_table_statement:
-    - keyword: CREATE
-    - keyword: TABLE
-    - table_reference:
-      - identifier: '[dbo]'
-      - dot: .
-      - identifier: '[EC DC]'
-    - bracketed:
-      - start_bracket: (
-      - column_definition:
-          identifier: '[Column B]'
-          data_type:
-            identifier: '[varchar]'
-            bracketed:
-              start_bracket: (
-              expression:
-                literal: '100'
-              end_bracket: )
-      - comma: ','
-      - column_definition:
-          identifier: '[ColumnC]'
-          data_type:
-            identifier: varchar
-            bracketed:
-              start_bracket: (
-              expression:
-                literal: '100'
-              end_bracket: )
-      - comma: ','
-      - column_definition:
-          identifier: '[ColumnDecimal]'
-          data_type:
-            identifier: decimal
-            bracketed:
-            - start_bracket: (
-            - expression:
-                literal: '10'
-            - comma: ','
-            - expression:
-                literal: '3'
-            - end_bracket: )
-      - end_bracket: )
+  batch:
+    statement:
+      create_table_statement:
+      - keyword: CREATE
+      - keyword: TABLE
+      - table_reference:
+        - identifier: '[dbo]'
+        - dot: .
+        - identifier: '[EC DC]'
+      - bracketed:
+        - start_bracket: (
+        - column_definition:
+            identifier: '[Column B]'
+            data_type:
+              identifier: '[varchar]'
+              bracketed:
+                start_bracket: (
+                expression:
+                  literal: '100'
+                end_bracket: )
+        - comma: ','
+        - column_definition:
+            identifier: '[ColumnC]'
+            data_type:
+              identifier: varchar
+              bracketed:
+                start_bracket: (
+                expression:
+                  literal: '100'
+                end_bracket: )
+        - comma: ','
+        - column_definition:
+            identifier: '[ColumnDecimal]'
+            data_type:
+              identifier: decimal
+              bracketed:
+              - start_bracket: (
+              - expression:
+                  literal: '10'
+              - comma: ','
+              - expression:
+                  literal: '3'
+              - end_bracket: )
+        - end_bracket: )
diff --git a/test/fixtures/parser/tsql/create_table_as_select.yml b/test/fixtures/parser/tsql/create_table_as_select.yml
index 6273b50525f..42506dfa427 100644
--- a/test/fixtures/parser/tsql/create_table_as_select.yml
+++ b/test/fixtures/parser/tsql/create_table_as_select.yml
@@ -3,114 +3,115 @@
 # computed by SQLFluff when running the tests. Please run
 # `python test/generate_parse_fixture_yml.py`  to generate them after adding or
 # altering SQL files.
-_hash: ccf2139792b0b001dbf8c281b026f2c7c8afa5a781ed1a9802d16aa0f27c804a
+_hash: 67a0dff78a2824a7e81e9a0b912a2111f64d10b882b21400a7943c99d7b8ed54
 file:
-  statement:
-    create_table_as_select_statement:
-    - keyword: CREATE
-    - keyword: TABLE
-    - table_reference:
-      - identifier: '[dbo]'
-      - dot: .
-      - identifier: '[PL_stage]'
-    - table_distribution_index_clause:
-        keyword: WITH
-        bracketed:
-          start_bracket: (
-          table_distribution_clause:
-          - keyword: DISTRIBUTION
-          - comparison_operator: '='
-          - keyword: HASH
-          - bracketed:
-              start_bracket: (
+  batch:
+    statement:
+      create_table_as_select_statement:
+      - keyword: CREATE
+      - keyword: TABLE
+      - table_reference:
+        - identifier: '[dbo]'
+        - dot: .
+        - identifier: '[PL_stage]'
+      - table_distribution_index_clause:
+          keyword: WITH
+          bracketed:
+            start_bracket: (
+            table_distribution_clause:
+            - keyword: DISTRIBUTION
+            - comparison_operator: '='
+            - keyword: HASH
+            - bracketed:
+                start_bracket: (
+                column_reference:
+                  identifier: '[ID]'
+                end_bracket: )
+            comma: ','
+            table_index_clause:
+              keyword: HEAP
+            end_bracket: )
+      - keyword: AS
+      - select_statement:
+          select_clause:
+          - keyword: SELECT
+          - select_clause_element:
               column_reference:
-                identifier: '[ID]'
-              end_bracket: )
-          comma: ','
-          table_index_clause:
-            keyword: HEAP
-          end_bracket: )
-    - keyword: AS
-    - select_statement:
-        select_clause:
-        - keyword: SELECT
-        - select_clause_element:
-            column_reference:
-            - identifier: e
-            - dot: .
-            - identifier: '[ID]'
-        - comma: ','
-        - select_clause_element:
-            column_reference:
-            - identifier: e
-            - dot: .
-            - identifier: '[ArriveDate]'
-        - comma: ','
-        - select_clause_element:
-            column_reference:
-            - identifier: e
-            - dot: .
-            - identifier: '[Contribution]'
-        - comma: ','
-        - select_clause_element:
-            column_reference:
-            - identifier: e
-            - dot: .
-            - identifier: '[DischargeDate]'
-        - comma: ','
-        - select_clause_element:
-            column_reference:
-            - identifier: e
-            - dot: .
-            - identifier: '[Encounter]'
-        - comma: ','
-        - select_clause_element:
-            column_reference:
-            - identifier: e
-            - dot: .
-            - identifier: '[Facility]'
-        - comma: ','
-        - select_clause_element:
-            column_reference:
-            - identifier: e
-            - dot: .
-            - identifier: '[Region]'
-        - comma: ','
-        - select_clause_element:
-            column_reference:
-            - identifier: e
-            - dot: .
-            - identifier: '[LOS]'
-        from_clause:
-          keyword: FROM
-          from_expression:
-            from_expression_element:
-              table_expression:
-                table_reference:
-                - identifier: dbo
-                - dot: .
-                - identifier: Encounter
-              alias_expression:
-                identifier: e
-            join_clause:
-              keyword: JOIN
+              - identifier: e
+              - dot: .
+              - identifier: '[ID]'
+          - comma: ','
+          - select_clause_element:
+              column_reference:
+              - identifier: e
+              - dot: .
+              - identifier: '[ArriveDate]'
+          - comma: ','
+          - select_clause_element:
+              column_reference:
+              - identifier: e
+              - dot: .
+              - identifier: '[Contribution]'
+          - comma: ','
+          - select_clause_element:
+              column_reference:
+              - identifier: e
+              - dot: .
+              - identifier: '[DischargeDate]'
+          - comma: ','
+          - select_clause_element:
+              column_reference:
+              - identifier: e
+              - dot: .
+              - identifier: '[Encounter]'
+          - comma: ','
+          - select_clause_element:
+              column_reference:
+              - identifier: e
+              - dot: .
+              - identifier: '[Facility]'
+          - comma: ','
+          - select_clause_element:
+              column_reference:
+              - identifier: e
+              - dot: .
+              - identifier: '[Region]'
+          - comma: ','
+          - select_clause_element:
+              column_reference:
+              - identifier: e
+              - dot: .
+              - identifier: '[LOS]'
+          from_clause:
+            keyword: FROM
+            from_expression:
               from_expression_element:
                 table_expression:
                   table_reference:
                   - identifier: dbo
                   - dot: .
-                  - identifier: Finance
+                  - identifier: Encounter
                 alias_expression:
-                  identifier: f
-              join_on_condition:
-                keyword: 'ON'
-                expression:
-                - column_reference:
-                  - identifier: e
-                  - dot: .
-                  - identifier: '[ID]'
-                - comparison_operator: '='
-                - column_reference:
-                  - identifier: f
-                  - dot: .
-                  - identifier: '[ID]'
+                  identifier: e
+              join_clause:
+                keyword: JOIN
+                from_expression_element:
+                  table_expression:
+                    table_reference:
+                    - identifier: dbo
+                    - dot: .
+                    - identifier: Finance
+                  alias_expression:
+                    identifier: f
+                join_on_condition:
+                  keyword: 'ON'
+                  expression:
+                  - column_reference:
+                    - identifier: e
+                    - dot: .
+                    - identifier: '[ID]'
+                  - comparison_operator: '='
+                  - column_reference:
+                    - identifier: f
+                    - dot: .
+                    - identifier: '[ID]'
diff --git a/test/fixtures/parser/tsql/create_table_with_distribution.yml b/test/fixtures/parser/tsql/create_table_with_distribution.yml
index 26afb0067b0..dfbcefb1486 100644
--- a/test/fixtures/parser/tsql/create_table_with_distribution.yml
+++ b/test/fixtures/parser/tsql/create_table_with_distribution.yml
@@ -3,63 +3,64 @@
 # computed by SQLFluff when running the tests. Please run
 # `python test/generate_parse_fixture_yml.py`  to generate them after adding or
 # altering SQL files.
-_hash: eaeb8b2cef95c274fb4931668ab729c4966484c1bccf1ba0ba98a91044808dc1
+_hash: dabc675120c9e5d0aa097e090ed36987987ceb72f82c8d5b2e102c294e4c5f3e
 file:
-  statement:
-    create_table_statement:
-    - keyword: CREATE
-    - keyword: TABLE
-    - table_reference:
-      - identifier: '[dbo]'
-      - dot: .
-      - identifier: '[EC DC]'
-    - bracketed:
-      - start_bracket: (
-      - column_definition:
-          identifier: '[Column B]'
-          data_type:
-            identifier: '[varchar]'
-            bracketed:
-              start_bracket: (
-              expression:
-                literal: '100'
-              end_bracket: )
-      - comma: ','
-      - column_definition:
-          identifier: '[ColumnC]'
-          data_type:
-            identifier: varchar
-            bracketed:
-              start_bracket: (
-              expression:
-                literal: '100'
-              end_bracket: )
-      - comma: ','
-      - column_definition:
-          identifier: '[ColumnDecimal]'
-          data_type:
-            identifier: decimal
-            bracketed:
-            - start_bracket: (
-            - expression:
-                literal: '10'
-            - comma: ','
-            - expression:
-                literal: '3'
-            - end_bracket: )
-      - end_bracket: )
-    - table_distribution_index_clause:
-        keyword: WITH
-        bracketed:
-          start_bracket: (
-          table_index_clause:
-          - keyword: CLUSTERED
-          - keyword: COLUMNSTORE
-          - keyword: INDEX
-          comma: ','
-          table_distribution_clause:
-          - keyword: DISTRIBUTION
-          - comparison_operator: '='
-          - keyword: ROUND_ROBIN
-          end_bracket: )
-  statement_terminator: ;
+  batch:
+    statement:
+      create_table_statement:
+      - keyword: CREATE
+      - keyword: TABLE
+      - table_reference:
+        - identifier: '[dbo]'
+        - dot: .
+        - identifier: '[EC DC]'
+      - bracketed:
+        - start_bracket: (
+        - column_definition:
+            identifier: '[Column B]'
+            data_type:
+              identifier: '[varchar]'
+              bracketed:
+                start_bracket: (
+                expression:
+                  literal: '100'
+                end_bracket: )
+        - comma: ','
+        - column_definition:
+            identifier: '[ColumnC]'
+            data_type:
+              identifier: varchar
+              bracketed:
+                start_bracket: (
+                expression:
+                  literal: '100'
+                end_bracket: )
+        - comma: ','
+        - column_definition:
+            identifier: '[ColumnDecimal]'
+            data_type:
+              identifier: decimal
+              bracketed:
+              - start_bracket: (
+              - expression:
+                  literal: '10'
+              - comma: ','
+              - expression:
+                  literal: '3'
+              - end_bracket: )
+        - end_bracket: )
+      - table_distribution_index_clause:
+          keyword: WITH
+          bracketed:
+            start_bracket: (
+            table_index_clause:
+            - keyword: CLUSTERED
+            - keyword: COLUMNSTORE
+            - keyword: INDEX
+            comma: ','
+            table_distribution_clause:
+            - keyword: DISTRIBUTION
+            - comparison_operator: '='
+            - keyword: ROUND_ROBIN
+            end_bracket: )
+    statement_terminator: ;
diff --git a/test/fixtures/parser/tsql/create_table_with_sequence.yml b/test/fixtures/parser/tsql/create_table_with_sequence.yml
index 939b065af00..27b0ce45462 100644
--- a/test/fixtures/parser/tsql/create_table_with_sequence.yml
+++ b/test/fixtures/parser/tsql/create_table_with_sequence.yml
@@ -3,71 +3,72 @@
 # computed by SQLFluff when running the tests. Please run
 # `python test/generate_parse_fixture_yml.py`  to generate them after adding or
 # altering SQL files.
-_hash: 8e09dccdafcc970282f3b5027d00344c2bbc420160d37dc5f4ec964fe2a9f2b0
+_hash: 9d5c74baf73423683a79124863529787475d326af6aa4fec49e9843efa603dce
 file:
-  statement:
-    create_table_statement:
-    - keyword: CREATE
-    - keyword: TABLE
-    - table_reference:
-      - identifier: DEST
-      - dot: .
-      - identifier: MELDER
-    - bracketed:
-      - start_bracket: (
-      - column_definition:
-        - identifier: '[ID]'
-        - data_type:
-            identifier: INT
-        - column_constraint_segment:
-          - keyword: PRIMARY
-          - keyword: KEY
-        - column_constraint_segment:
-          - keyword: NOT
-          - keyword: 'NULL'
-        - column_constraint_segment:
-            keyword: DEFAULT
-            sequence_next_value:
-            - keyword: NEXT
-            - keyword: VALUE
-            - keyword: FOR
-            - object_reference:
-              - identifier: '[dbo]'
-              - dot: .
-              - identifier: '[SEQ_MELDER]'
-      - comma: ','
-      - column_definition:
-          identifier: '[DOWNLOADED_TOTAL]'
-          data_type:
-            identifier: INT
-          column_constraint_segment:
-            keyword: 'NULL'
-      - comma: ','
-      - column_definition:
-          identifier: '[WARNED_DAILY]'
-          data_type:
-            identifier: INT
-          column_constraint_segment:
-            keyword: 'NULL'
-      - comma: ','
-      - column_definition:
-          identifier: '[DATE_OF_REPORT]'
-          data_type:
-            identifier: DATETIME
-          column_constraint_segment:
-            keyword: 'NULL'
-      - comma: ','
-      - column_definition:
-          identifier: DATE_LAST_INSERTED
-          data_type:
-            identifier: DATETIME
-          column_constraint_segment:
-            keyword: DEFAULT
-            function:
-              function_name:
-                function_name_identifier: GETDATE
-              bracketed:
-                start_bracket: (
-                end_bracket: )
-      - end_bracket: )
-  statement_terminator: ;
+  batch:
+    statement:
+      create_table_statement:
+      - keyword: CREATE
+      - keyword: TABLE
+      - table_reference:
+        - identifier: DEST
+        - dot: .
+        - identifier: MELDER
+      - bracketed:
+        - start_bracket: (
+        - column_definition:
+          - identifier: '[ID]'
+          - data_type:
+              identifier: INT
+          - column_constraint_segment:
+            - keyword: PRIMARY
+            - keyword: KEY
+          - column_constraint_segment:
+            - keyword: NOT
+            - keyword: 'NULL'
+          - column_constraint_segment:
+              keyword: DEFAULT
+              sequence_next_value:
+              - keyword: NEXT
+              - keyword: VALUE
+              - keyword: FOR
+              - object_reference:
+                - identifier: '[dbo]'
+                - dot: .
+                - identifier: '[SEQ_MELDER]'
+        - comma: ','
+        - column_definition:
+            identifier: '[DOWNLOADED_TOTAL]'
+            data_type:
+              identifier: INT
+            column_constraint_segment:
+              keyword: 'NULL'
+        - comma: ','
+        - column_definition:
+            identifier: '[WARNED_DAILY]'
+            data_type:
+              identifier: INT
+            column_constraint_segment:
+              keyword: 'NULL'
+        - comma: ','
+        - column_definition:
+            identifier: '[DATE_OF_REPORT]'
+            data_type:
+              identifier: DATETIME
+            column_constraint_segment:
+              keyword: 'NULL'
+        - comma: ','
+        - column_definition:
+            identifier: DATE_LAST_INSERTED
+            data_type:
+              identifier: DATETIME
+            column_constraint_segment:
+              keyword: DEFAULT
+              function:
+                function_name:
+                  function_name_identifier: GETDATE
+                bracketed:
+                  start_bracket: (
+                  end_bracket: )
+        - end_bracket: )
+    statement_terminator: ;
diff --git a/test/fixtures/parser/tsql/create_table_with_sequence_bracketed.yml b/test/fixtures/parser/tsql/create_table_with_sequence_bracketed.yml
index 3d9a9ebb713..3398b307d36 100644
--- a/test/fixtures/parser/tsql/create_table_with_sequence_bracketed.yml
+++ b/test/fixtures/parser/tsql/create_table_with_sequence_bracketed.yml
@@ -3,638 +3,643 @@
 # computed by SQLFluff when running the tests. Please run
 # `python test/generate_parse_fixture_yml.py`  to generate them after adding or
 # altering SQL files.
-_hash: 684d0bd2a385cfe3dc469475f3071353c2377db4297ba683ef689fdeaee28142
+_hash: 575044b93b5f4a3427dd4f7b2e9c4ec97f15aac17c7875c7549ee99a15b169a5
 file:
-- statement:
-    if_then_statement:
-      keyword: IF
-      statement:
-        if_then_statement:
-          expression:
-          - keyword: NOT
-          - keyword: EXISTS
-          - bracketed:
-              start_bracket: (
-              expression:
-                select_statement:
-                  select_clause:
-                    keyword: SELECT
-                    select_clause_element:
-                      wildcard_expression:
-                        wildcard_identifier:
-                          star: '*'
-                  from_clause:
-                    keyword: FROM
-                    from_expression:
-                      from_expression_element:
-                        table_expression:
-                          table_reference:
-                          - identifier: sys
-                          - dot: .
-                          - identifier: sequences
-                  where_clause:
-                    keyword: WHERE
-                    expression:
-                    - column_reference:
-                        identifier: object_id
-                    - comparison_operator: '='
-                    - function:
-                        function_name:
-                          function_name_identifier: OBJECT_ID
-                        bracketed:
-                          start_bracket: (
-                          expression:
-                            literal: "N'[dbo].[SEQ_SCHEMA_NAME_TABLE_NAME]'"
-                          end_bracket: )
-                    - binary_operator: AND
-                    - column_reference:
-                        identifier: type
-                    - comparison_operator: '='
-                    - literal: "'SO'"
-              end_bracket: )
-          statement:
-            create_sequence_statement:
-            - keyword: CREATE
-            - keyword: SEQUENCE
-            - sequence_reference:
-                identifier: SEQ_SCHEMA_NAME_TABLE_NAME
-            - create_sequence_options_segment:
-              - keyword: START
-              - keyword: WITH
-              - literal: '1'
-            - create_sequence_options_segment:
-              - keyword: INCREMENT
-              - keyword: BY
-              - literal: '1'
-- statement_terminator: ;
+- batch:
+    statement:
+      if_then_statement:
+        keyword: IF
+        statement:
+          if_then_statement:
+            expression:
+            - keyword: NOT
+            - keyword: EXISTS
+            - bracketed:
+                start_bracket: (
+                expression:
+                  select_statement:
+                    select_clause:
+                      keyword: SELECT
+                      select_clause_element:
+                        wildcard_expression:
+                          wildcard_identifier:
+                            star: '*'
+                    from_clause:
+                      keyword: FROM
+                      from_expression:
+                        from_expression_element:
+                          table_expression:
+                            table_reference:
+                            - identifier: sys
+                            - dot: .
+                            - identifier: sequences
+                    where_clause:
+                      keyword: WHERE
+                      expression:
+                      - column_reference:
+                          identifier: object_id
+                      - comparison_operator: '='
+                      - function:
+                          function_name:
+                            function_name_identifier: OBJECT_ID
+                          bracketed:
+                            start_bracket: (
+                            expression:
+                              literal: "N'[dbo].[SEQ_SCHEMA_NAME_TABLE_NAME]'"
+                            end_bracket: )
+                      - binary_operator: AND
+                      - column_reference:
+                          identifier: type
+                      - comparison_operator: '='
+                      - literal: "'SO'"
+                end_bracket: )
+            statement:
+              create_sequence_statement:
+              - keyword: CREATE
+              - keyword: SEQUENCE
+              - sequence_reference:
+                  identifier: SEQ_SCHEMA_NAME_TABLE_NAME
+              - create_sequence_options_segment:
+                - keyword: START
+                - keyword: WITH
+                - literal: '1'
+              - create_sequence_options_segment:
+                - keyword: INCREMENT
+                - keyword: BY
+                - literal: '1'
+    statement_terminator: ;
 - go_statement:
     keyword: GO
-- statement:
-    create_table_statement:
-    - keyword: CREATE
-    - keyword: TABLE
-    - table_reference:
-      - identifier: SCHEMA_NAME
-      - dot: .
-      - identifier: TABLE_NAME
-    - bracketed:
-      - start_bracket: (
-      - column_definition:
-        - identifier: '[ID]'
-        - data_type:
-            identifier: INT
-        - column_constraint_segment:
-          - keyword: PRIMARY
-          - keyword: KEY
-        - column_constraint_segment:
-          - keyword: NOT
-          - keyword: 'NULL'
-        - column_constraint_segment:
-            keyword: DEFAULT
-            bracketed:
-              start_bracket: (
-              sequence_next_value:
-              - keyword: NEXT
-              - keyword: VALUE
-              - keyword: FOR
-              - object_reference:
-                - identifier: '[dbo]'
-                - dot: .
-                - identifier: '[SEQ_SCHEMA_NAME_TABLE_NAME]'
-              end_bracket: )
-      - comma: ','
-      - column_definition:
-          identifier: '[WEEK_UNIX]'
-          data_type:
-            identifier: BIGINT
-      - comma: ','
-      - column_definition:
-          identifier: GMCODE
-          data_type:
-            identifier: VARCHAR
-            bracketed:
-              start_bracket: (
-              expression:
-                literal: '100'
-              end_bracket: )
-      - comma: ','
-      - column_definition:
-          identifier: AVERAGE_RNA_FLOW_PER_100000
-          data_type:
-            identifier: DECIMAL
-            bracketed:
-            - start_bracket: (
-            - expression:
-                literal: '16'
-            - comma: ','
-            - expression:
-                literal: '2'
-            - end_bracket: )
-          column_constraint_segment:
-            keyword: 'NULL'
-      - comma: ','
-      - column_definition:
-          identifier: NUMBER_OF_MEASUREMENTS
-          data_type:
-            identifier: INT
-          column_constraint_segment:
-            keyword: 'NULL'
-      - comma: ','
-      - column_definition:
-          identifier: NUMBER_OF_LOCATIONS
-          data_type:
-            identifier: INT
-          column_constraint_segment:
-            keyword: 'NULL'
-      - comma: ','
-      - column_definition:
-          identifier: TOTAL_LOCATIONS
-          data_type:
-            identifier: INT
-          column_constraint_segment:
-            keyword: 'NULL'
-      - comma: ','
-      - column_definition:
-          identifier: DATE_LAST_INSERTED
-          data_type:
-            identifier: DATETIME
-          column_constraint_segment:
-            keyword: DEFAULT
-            function:
-              function_name:
-                function_name_identifier: GETDATE
+- batch:
+  - statement:
+      create_table_statement:
+      - keyword: CREATE
+      - keyword: TABLE
+      - table_reference:
+        - identifier: SCHEMA_NAME
+        - dot: .
+        - identifier: TABLE_NAME
+      - bracketed:
+        - start_bracket: (
+        - column_definition:
+          - identifier: '[ID]'
+          - data_type:
+              identifier: INT
+          - column_constraint_segment:
+            - keyword: PRIMARY
+            - keyword: KEY
+          - column_constraint_segment:
+            - keyword: NOT
+            - keyword: 'NULL'
+          - column_constraint_segment:
+              keyword: DEFAULT
+              bracketed:
+                start_bracket: (
+                sequence_next_value:
+                - keyword: NEXT
+                - keyword: VALUE
+                - keyword: FOR
+                - object_reference:
+                  - identifier: '[dbo]'
+                  - dot: .
+                  - identifier: '[SEQ_SCHEMA_NAME_TABLE_NAME]'
+                end_bracket: )
+        - comma: ','
+        - column_definition:
+            identifier: '[WEEK_UNIX]'
+            data_type:
+              identifier: BIGINT
+        - comma: ','
+        - column_definition:
+            identifier: GMCODE
+            data_type:
+              identifier: VARCHAR
+              bracketed:
+                start_bracket: (
+                expression:
+                  literal: '100'
+                end_bracket: )
+        - comma: ','
+        - column_definition:
+            identifier: AVERAGE_RNA_FLOW_PER_100000
+            data_type:
+              identifier: DECIMAL
               bracketed:
+              - start_bracket: (
+              - expression:
+                  literal: '16'
+              - comma: ','
+              - expression:
+                  literal: '2'
+              - end_bracket: )
+            column_constraint_segment:
+              keyword: 'NULL'
+        - comma: ','
+        - column_definition:
+            identifier: NUMBER_OF_MEASUREMENTS
+            data_type:
+              identifier: INT
+            column_constraint_segment:
+              keyword: 'NULL'
+        - comma: ','
+        - column_definition:
+            identifier: NUMBER_OF_LOCATIONS
+            data_type:
+              identifier: INT
+            column_constraint_segment:
+              keyword: 'NULL'
+        - comma: ','
+        - column_definition:
+            identifier: TOTAL_LOCATIONS
+            data_type:
+              identifier: INT
+            column_constraint_segment:
+              keyword: 'NULL'
+        - comma: ','
+        - column_definition:
+            identifier: DATE_LAST_INSERTED
+            data_type:
+              identifier: DATETIME
+            column_constraint_segment:
+              keyword: DEFAULT
+              function:
+                function_name:
+                  function_name_identifier: GETDATE
+                bracketed:
+                  start_bracket: (
+                  end_bracket: )
+        - end_bracket: )
+  - statement_terminator: ;
+  - statement:
+      if_then_statement:
+        keyword: IF
+        statement:
+          if_then_statement:
+            expression:
+            - keyword: NOT
+            - keyword: EXISTS
+            - bracketed:
                 start_bracket: (
+                expression:
+                  select_statement:
+                    select_clause:
+                      keyword: SELECT
+                      select_clause_element:
+                        wildcard_expression:
+                          wildcard_identifier:
+                            star: '*'
+                    from_clause:
+                      keyword: FROM
+                      from_expression:
+                        from_expression_element:
+                          table_expression:
+                            table_reference:
+                            - identifier: sys
+                            - dot: .
+                            - identifier: sequences
+                    where_clause:
+                      keyword: WHERE
+                      expression:
+                      - column_reference:
+                          identifier: object_id
+                      - comparison_operator: '='
+                      - function:
+                          function_name:
+                            function_name_identifier: OBJECT_ID
+                          bracketed:
+                            start_bracket: (
+                            expression:
+                              literal: "N'[dbo].[SEQ_STAGE_CBS_POPULATION_BASE]'"
+                            end_bracket: )
+                      - binary_operator: AND
+                      - column_reference:
+                          identifier: type
+                      - comparison_operator: '='
+                      - literal: "'SO'"
                 end_bracket: )
-      - end_bracket: )
-- statement_terminator: ;
-- statement:
-    if_then_statement:
-      keyword: IF
-      statement:
-        if_then_statement:
-          expression:
-          - keyword: NOT
-          - keyword: EXISTS
-          - bracketed:
-              start_bracket: (
-              expression:
-                select_statement:
-                  select_clause:
-                    keyword: SELECT
-                    select_clause_element:
-                      wildcard_expression:
-                        wildcard_identifier:
-                          star: '*'
-                  from_clause:
-                    keyword: FROM
-                    from_expression:
-                      from_expression_element:
-                        table_expression:
-                          table_reference:
-                          - identifier: sys
-                          - dot: .
-                          - identifier: sequences
-                  where_clause:
-                    keyword: WHERE
-                    expression:
-                    - column_reference:
-                        identifier: object_id
-                    - comparison_operator: '='
-                    - function:
-                        function_name:
-                          function_name_identifier: OBJECT_ID
-                        bracketed:
-                          start_bracket: (
-                          expression:
-                            literal: "N'[dbo].[SEQ_STAGE_CBS_POPULATION_BASE]'"
-                          end_bracket: )
-                    - binary_operator: AND
-                    - column_reference:
-                        identifier: type
-                    - comparison_operator: '='
-                    - literal: "'SO'"
-              end_bracket: )
-          statement:
-            create_sequence_statement:
-            - keyword: CREATE
-            - keyword: SEQUENCE
-            - sequence_reference:
-                identifier: SEQ_STAGE_CBS_POPULATION_BASE
-            - create_sequence_options_segment:
-              - keyword: START
-              - keyword: WITH
-              - literal: '1'
-            - create_sequence_options_segment:
-              - keyword: INCREMENT
-              - keyword: BY
-              - literal: '1'
-- statement_terminator: ;
+            statement:
+              create_sequence_statement:
+              - keyword: CREATE
+              - keyword: SEQUENCE
+              - sequence_reference:
+                  identifier: SEQ_STAGE_CBS_POPULATION_BASE
+              - create_sequence_options_segment:
+                - keyword: START
+                - keyword: WITH
+                - literal: '1'
+              - create_sequence_options_segment:
+                - keyword: INCREMENT
+                - keyword: BY
+                - literal: '1'
+  - statement_terminator: ;
 - go_statement:
     keyword: GO
-- statement:
-    create_table_statement:
-    - keyword: CREATE
-    - keyword: TABLE
-    - table_reference:
-      - identifier: STAGE
-      - dot: .
-      - identifier: CBS_POPULATION_BASE
-    - bracketed:
-      - start_bracket: (
-      - column_definition:
-        - identifier: '[ID]'
-        - data_type:
-            identifier: INT
-        - column_constraint_segment:
-          - keyword: PRIMARY
-          - keyword: KEY
-          - keyword: NONCLUSTERED
-        - column_constraint_segment:
-          - keyword: NOT
-          - keyword: 'NULL'
-        - column_constraint_segment:
-            keyword: DEFAULT
-            bracketed:
-              start_bracket: (
-              sequence_next_value:
-              - keyword: NEXT
-              - keyword: VALUE
-              - keyword: FOR
-              - object_reference:
-                - identifier: '[dbo]'
-                - dot: .
-                - identifier: '[SEQ_STAGE_CBS_POPULATION_BASE]'
-              end_bracket: )
-      - comma: ','
-      - column_definition:
-          identifier: GEMEENTE_CODE
-          data_type:
-            identifier: VARCHAR
-            bracketed:
-              start_bracket: (
-              expression:
-                literal: '100'
-              end_bracket: )
-          column_constraint_segment:
-            keyword: 'NULL'
-      - comma: ','
-      - column_definition:
-          identifier: GEMEENTE
-          data_type:
-            identifier: VARCHAR
-            bracketed:
-              start_bracket: (
-              expression:
-                literal: '100'
-              end_bracket: )
-          column_constraint_segment:
-            keyword: 'NULL'
-      - comma: ','
-      - column_definition:
-          identifier: LEEFTIJD
-          data_type:
-            identifier: VARCHAR
-            bracketed:
-              start_bracket: (
-              expression:
-                literal: '100'
-              end_bracket: )
-          column_constraint_segment:
-            keyword: 'NULL'
-      - comma: ','
-      - column_definition:
-          identifier: GESLACHT
-          data_type:
-            identifier: VARCHAR
-            bracketed:
-              start_bracket: (
-              expression:
-                literal: '100'
-              end_bracket: )
-          column_constraint_segment:
-            keyword: 'NULL'
-      - comma: ','
-      - column_definition:
-          identifier: DATUM_PEILING
-          data_type:
-            identifier: VARCHAR
-            bracketed:
-              start_bracket: (
-              expression:
-                literal: '100'
-              end_bracket: )
-          column_constraint_segment:
-            keyword: 'NULL'
-      - comma: ','
-      - column_definition:
-          identifier: POPULATIE
-          data_type:
-            identifier: VARCHAR
-            bracketed:
-              start_bracket: (
-              expression:
-                literal: '100'
-              end_bracket: )
-          column_constraint_segment:
-            keyword: 'NULL'
-      - comma: ','
-      - column_definition:
-          identifier: VEILIGHEIDSREGIO_CODE
-          data_type:
-            identifier: VARCHAR
-            bracketed:
-              start_bracket: (
-              expression:
-                literal: '100'
-              end_bracket: )
-          column_constraint_segment:
-            keyword: 'NULL'
-      - comma: ','
-      - column_definition:
-          identifier: VEILIGHEIDSREGIO_NAAM
-          data_type:
-            identifier: VARCHAR
-            bracketed:
-              start_bracket: (
-              expression:
-                literal: '100'
-              end_bracket: )
-          column_constraint_segment:
-            keyword: 'NULL'
-      - comma: ','
-      - column_definition:
-          identifier: PROVINCIE_CODE
-          data_type:
-            identifier: VARCHAR
-            bracketed:
-              start_bracket: (
-              expression:
-                literal: '100'
-              end_bracket: )
-          column_constraint_segment:
-            keyword: 'NULL'
-      - comma: ','
-      - column_definition:
-          identifier: PROVINCIE_NAAM
-          data_type:
-            identifier: VARCHAR
-            bracketed:
-              start_bracket: (
-              expression:
-                literal: '100'
-              end_bracket: )
-          column_constraint_segment:
-            keyword: 'NULL'
-      - comma: ','
-      - column_definition:
-          identifier: GGD_CODE
-          data_type:
-            identifier: VARCHAR
-            bracketed:
-              start_bracket: (
-              expression:
-                literal: '100'
-              end_bracket: )
-          column_constraint_segment:
-            keyword: 'NULL'
-      - comma: ','
-      - column_definition:
-          identifier: GGD_NAAM
-          data_type:
-            identifier: VARCHAR
-            bracketed:
-              start_bracket: (
-              expression:
-                literal: '100'
-              end_bracket: )
-          column_constraint_segment:
-            keyword: 'NULL'
-      - comma: ','
-      - column_definition:
-          identifier: DATE_LAST_INSERTED
-          data_type:
-            identifier: DATETIME
-          column_constraint_segment:
-            keyword: DEFAULT
-            function:
-              function_name:
-                function_name_identifier: GETDATE
+- batch:
+    statement:
+      create_table_statement:
+      - keyword: CREATE
+      - keyword: TABLE
+      - table_reference:
+        - identifier: STAGE
+        - dot: .
+        - identifier: CBS_POPULATION_BASE
+      - bracketed:
+        - start_bracket: (
+        - column_definition:
+          - identifier: '[ID]'
+          - data_type:
+              identifier: INT
+          - column_constraint_segment:
+            - keyword: PRIMARY
+            - keyword: KEY
+            - keyword: NONCLUSTERED
+          - column_constraint_segment:
+            - keyword: NOT
+            - keyword: 'NULL'
+          - column_constraint_segment:
+              keyword: DEFAULT
+              bracketed:
+                start_bracket: (
+                sequence_next_value:
+                - keyword: NEXT
+                - keyword: VALUE
+                - keyword: FOR
+                - object_reference:
+                  - identifier: '[dbo]'
+                  - dot: .
+                  - identifier: '[SEQ_STAGE_CBS_POPULATION_BASE]'
+                end_bracket: )
+        - comma: ','
+        - column_definition:
+            identifier: GEMEENTE_CODE
+            data_type:
+              identifier: VARCHAR
+              bracketed:
+                start_bracket: (
+                expression:
+                  literal: '100'
+                end_bracket: )
+            column_constraint_segment:
+              keyword: 'NULL'
+        - comma: ','
+        - column_definition:
+            identifier: GEMEENTE
+            data_type:
+              identifier: VARCHAR
+              bracketed:
+                start_bracket: (
+                expression:
+                  literal: '100'
+                end_bracket: )
+            column_constraint_segment:
+              keyword: 'NULL'
+        - comma: ','
+        - column_definition:
+            identifier: LEEFTIJD
+            data_type:
+              identifier: VARCHAR
+              bracketed:
+                start_bracket: (
+                expression:
+                  literal: '100'
+                end_bracket: )
+            column_constraint_segment:
+              keyword: 'NULL'
+        - comma: ','
+        - column_definition:
+            identifier: GESLACHT
+            data_type:
+              identifier: VARCHAR
+              bracketed:
+                start_bracket: (
+                expression:
+                  literal: '100'
+                end_bracket: )
+            column_constraint_segment:
+              keyword: 'NULL'
+        - comma: ','
+        - column_definition:
+            identifier: DATUM_PEILING
+            data_type:
+              identifier: VARCHAR
+              bracketed:
+                start_bracket: (
+                expression:
+                  literal: '100'
+                end_bracket: )
+            column_constraint_segment:
+              keyword: 'NULL'
+        - comma: ','
+        - column_definition:
+            identifier: POPULATIE
+            data_type:
+              identifier: VARCHAR
+              bracketed:
+                start_bracket: (
+                expression:
+                  literal: '100'
+                end_bracket: )
+            column_constraint_segment:
+              keyword: 'NULL'
+        - comma: ','
+        - column_definition:
+            identifier: VEILIGHEIDSREGIO_CODE
+            data_type:
+              identifier: VARCHAR
+              bracketed:
+                start_bracket: (
+                expression:
+                  literal: '100'
+                end_bracket: )
+            column_constraint_segment:
+              keyword: 'NULL'
+        - comma: ','
+        - column_definition:
+            identifier: VEILIGHEIDSREGIO_NAAM
+            data_type:
+              identifier: VARCHAR
+              bracketed:
+                start_bracket: (
+                expression:
+                  literal: '100'
+                end_bracket: )
+            column_constraint_segment:
+              keyword: 'NULL'
+        - comma: ','
+        - column_definition:
+            identifier: PROVINCIE_CODE
+            data_type:
+              identifier: VARCHAR
+              bracketed:
+                start_bracket: (
+                expression:
+                  literal: '100'
+                end_bracket: )
+            column_constraint_segment:
+              keyword: 'NULL'
+        - comma: ','
+        - column_definition:
+            identifier: PROVINCIE_NAAM
+            data_type:
+              identifier: VARCHAR
+              bracketed:
+                start_bracket: (
+                expression:
+                  literal: '100'
+                end_bracket: )
+            column_constraint_segment:
+              keyword: 'NULL'
+        - comma: ','
+        - column_definition:
+            identifier: GGD_CODE
+            data_type:
+              identifier: VARCHAR
+              bracketed:
+                start_bracket: (
+                expression:
+                  literal: '100'
+                end_bracket: )
+            column_constraint_segment:
+              keyword: 'NULL'
+        - comma: ','
+        - column_definition:
+            identifier: GGD_NAAM
+            data_type:
+              identifier: VARCHAR
               bracketed:
                 start_bracket: (
+                expression:
+                  literal: '100'
                 end_bracket: )
-      - end_bracket: )
-- statement_terminator: ;
+            column_constraint_segment:
+              keyword: 'NULL'
+        - comma: ','
+        - column_definition:
+            identifier: DATE_LAST_INSERTED
+            data_type:
+              identifier: DATETIME
+            column_constraint_segment:
+              keyword: DEFAULT
+              function:
+                function_name:
+                  function_name_identifier: GETDATE
+                bracketed:
+                  start_bracket: (
+                  end_bracket: )
+        - end_bracket: )
+    statement_terminator: ;
 - go_statement:
     keyword: GO
-- statement:
-    create_index_statement:
-    - keyword: CREATE
-    - keyword: CLUSTERED
-    - keyword: INDEX
-    - index_reference:
-        identifier: CI_DLI_STAGE_CBS_POPULATION_BASE
-    - keyword: 'ON'
-    - table_reference:
-      - identifier: STAGE
-      - dot: .
-      - identifier: CBS_POPULATION_BASE
-    - bracketed:
-        start_bracket: (
-        index_column_definition:
-          identifier: DATE_LAST_INSERTED
-        end_bracket: )
+- batch:
+    statement:
+      create_index_statement:
+      - keyword: CREATE
+      - keyword: CLUSTERED
+      - keyword: INDEX
+      - index_reference:
+          identifier: CI_DLI_STAGE_CBS_POPULATION_BASE
+      - keyword: 'ON'
+      - table_reference:
+        - identifier: STAGE
+        - dot: .
+        - identifier: CBS_POPULATION_BASE
+      - bracketed:
+          start_bracket: (
+          index_column_definition:
+            identifier: DATE_LAST_INSERTED
+          end_bracket: )
 - go_statement:
     keyword: GO
-- statement:
-    create_index_statement:
-    - keyword: CREATE
-    - keyword: NONCLUSTERED
-    - keyword: INDEX
-    - index_reference:
-        identifier: NCI_DLI_STAGE_CIMS_VACCINATED_AGE_GROUP
-    - keyword: 'ON'
-    - table_reference:
-      - identifier: STAGE
-      - dot: .
-      - identifier: CBS_POPULATION_BASE
-    - bracketed:
-      - start_bracket: (
-      - index_column_definition:
-          identifier: DATE_LAST_INSERTED
-      - comma: ','
-      - index_column_definition:
-          identifier: GEMEENTE_CODE
-      - comma: ','
-      - index_column_definition:
-          identifier: GEMEENTE
-      - comma: ','
-      - index_column_definition:
-          identifier: LEEFTIJD
-      - comma: ','
-      - index_column_definition:
-          identifier: GESLACHT
-      - comma: ','
-      - index_column_definition:
-          identifier: DATUM_PEILING
-      - comma: ','
-      - index_column_definition:
-          identifier: POPULATIE
-      - comma: ','
-      - index_column_definition:
-          identifier: VEILIGHEIDSREGIO_CODE
-      - comma: ','
-      - index_column_definition:
-          identifier: VEILIGHEIDSREGIO_NAAM
-      - comma: ','
-      - index_column_definition:
-          identifier: PROVINCIE_CODE
-      - comma: ','
-      - index_column_definition:
-          identifier: PROVINCIE_NAAM
-      - comma: ','
-      - index_column_definition:
-          identifier: GGD_CODE
-      - comma: ','
-      - index_column_definition:
-          identifier: GGD_NAAM
-      - end_bracket: )
-- statement_terminator: ;
-- statement:
-    create_table_statement:
-    - keyword: CREATE
-    - keyword: TABLE
-    - table_reference:
-      - identifier: DEST
-      - dot: .
-      - identifier: POSITIVE_TESTED_PEOPLE
-    - bracketed:
-      - start_bracket: (
-      - column_definition:
-        - identifier: '[ID]'
-        - data_type:
-            identifier: INT
-        - column_constraint_segment:
-          - keyword: PRIMARY
-          - keyword: KEY
-        - column_constraint_segment:
-          - keyword: NOT
-          - keyword: 'NULL'
-        - column_constraint_segment:
-            keyword: DEFAULT
-            bracketed:
-              start_bracket: (
-              sequence_next_value:
-              - keyword: NEXT
-              - keyword: VALUE
-              - keyword: FOR
-              - object_reference:
-                - identifier: '[dbo]'
-                - dot: .
-                - identifier: '[SEQ_DEST_POSITIVE_TESTED_PEOPLE]'
-              end_bracket: )
-      - comma: ','
-      - column_definition:
-          identifier: DATE_OF_REPORT
-          data_type:
-            identifier: DATETIME
-          column_constraint_segment:
-            keyword: 'NULL'
-      - comma: ','
-      - column_definition:
-          identifier: DATE_OF_REPORT_UNIX
-          data_type:
-            identifier: BIGINT
-          column_constraint_segment:
-            keyword: 'NULL'
-      - comma: ','
-      - column_definition:
-          identifier: INFECTED_DAILY_INCREASE
-          data_type:
-            identifier: DECIMAL
-            bracketed:
-            - start_bracket: (
-            - expression:
-                literal: '16'
-            - comma: ','
-            - expression:
-                literal: '1'
-            - end_bracket: )
-          column_constraint_segment:
-            keyword: 'NULL'
-      - comma: ','
-      - column_definition:
-          identifier: INFECTED_DAILY_TOTAL
-          data_type:
-            identifier: INT
-          column_constraint_segment:
-            keyword: 'NULL'
-      - comma: ','
-      - column_definition:
-          identifier: DATE_LAST_INSERTED
-          data_type:
-            identifier: DATETIME
-          column_constraint_segment:
-            keyword: DEFAULT
-            function:
-              function_name:
-                function_name_identifier: GETDATE
+- batch:
+  - statement:
+      create_index_statement:
+      - keyword: CREATE
+      - keyword: NONCLUSTERED
+      - keyword: INDEX
+      - index_reference:
+          identifier: NCI_DLI_STAGE_CIMS_VACCINATED_AGE_GROUP
+      - keyword: 'ON'
+      - table_reference:
+        - identifier: STAGE
+        - dot: .
+        - identifier: CBS_POPULATION_BASE
+      - bracketed:
+        - start_bracket: (
+        - index_column_definition:
+            identifier: DATE_LAST_INSERTED
+        - comma: ','
+        - index_column_definition:
+            identifier: GEMEENTE_CODE
+        - comma: ','
+        - index_column_definition:
+            identifier: GEMEENTE
+        - comma: ','
+        - index_column_definition:
+            identifier: LEEFTIJD
+        - comma: ','
+        - index_column_definition:
+            identifier: GESLACHT
+        - comma: ','
+        - index_column_definition:
+            identifier: DATUM_PEILING
+        - comma: ','
+        - index_column_definition:
+            identifier: POPULATIE
+        - comma: ','
+        - index_column_definition:
+            identifier: VEILIGHEIDSREGIO_CODE
+        - comma: ','
+        - index_column_definition:
+            identifier: VEILIGHEIDSREGIO_NAAM
+        - comma: ','
+        - index_column_definition:
+            identifier: PROVINCIE_CODE
+        - comma: ','
+        - index_column_definition:
+            identifier: PROVINCIE_NAAM
+        - comma: ','
+        - index_column_definition:
+            identifier: GGD_CODE
+        - comma: ','
+        - index_column_definition:
+            identifier: GGD_NAAM
+        - end_bracket: )
+  - statement_terminator: ;
+  - statement:
+      create_table_statement:
+      - keyword: CREATE
+      - keyword: TABLE
+      - table_reference:
+        - identifier: DEST
+        - dot: .
+        - identifier: POSITIVE_TESTED_PEOPLE
+      - bracketed:
+        - start_bracket: (
+        - column_definition:
+          - identifier: '[ID]'
+          - data_type:
+              identifier: INT
+          - column_constraint_segment:
+            - keyword: PRIMARY
+            - keyword: KEY
+          - column_constraint_segment:
+            - keyword: NOT
+            - keyword: 'NULL'
+          - column_constraint_segment:
+              keyword: DEFAULT
               bracketed:
                 start_bracket: (
+                sequence_next_value:
+                - keyword: NEXT
+                - keyword: VALUE
+                - keyword: FOR
+                - object_reference:
+                  - identifier: '[dbo]'
+                  - dot: .
+                  - identifier: '[SEQ_DEST_POSITIVE_TESTED_PEOPLE]'
                 end_bracket: )
-      - comma: ','
-      - column_definition:
-          identifier: '[DATE_RANGE_START]'
-          data_type:
-            identifier: datetime
-      - comma: ','
-      - column_definition:
-          identifier: '[DATE_OF_REPORTS_LAG]'
-          data_type:
-            identifier: datetime
-      - comma: ','
-      - column_definition:
-          identifier: '[DATE_RANGE_START_LAG]'
-          data_type:
-            identifier: datetime
-      - comma: ','
-      - column_definition:
-          identifier: '[7D_AVERAGE_INFECTED_DAILY_INCREASE_TOTAL]'
-          data_type:
-            identifier: decimal
-            bracketed:
-            - start_bracket: (
-            - expression:
-                literal: '16'
-            - comma: ','
-            - expression:
-                literal: '2'
-            - end_bracket: )
-      - comma: ','
-      - column_definition:
-          identifier: '[7D_AVERAGE_INFECTED_DAILY_INCREASE_LAG]'
-          data_type:
-            identifier: decimal
-            bracketed:
-            - start_bracket: (
-            - expression:
-                literal: '16'
-            - comma: ','
-            - expression:
-                literal: '2'
-            - end_bracket: )
-      - comma: ','
-      - column_definition:
-          identifier: '[7D_AVERAGE_INFECTED_DAILY_INCREASE_ABSOLUTE]'
-          data_type:
-            identifier: decimal
-            bracketed:
-            - start_bracket: (
-            - expression:
-                literal: '16'
-            - comma: ','
-            - expression:
-                literal: '2'
-            - end_bracket: )
-      - end_bracket: )
-- statement_terminator: ;
+        - comma: ','
+        - column_definition:
+            identifier: DATE_OF_REPORT
+            data_type:
+              identifier: DATETIME
+            column_constraint_segment:
+              keyword: 'NULL'
+        - comma: ','
+        - column_definition:
+            identifier: DATE_OF_REPORT_UNIX
+            data_type:
+              identifier: BIGINT
+            column_constraint_segment:
+              keyword: 'NULL'
+        - comma: ','
+        - column_definition:
+            identifier: INFECTED_DAILY_INCREASE
+            data_type:
+              identifier: DECIMAL
+              bracketed:
+              - start_bracket: (
+              - expression:
+                  literal: '16'
+              - comma: ','
+              - expression:
+                  literal: '1'
+              - end_bracket: )
+            column_constraint_segment:
+              keyword: 'NULL'
+        - comma: ','
+        - column_definition:
+            identifier: INFECTED_DAILY_TOTAL
+            data_type:
+              identifier: INT
+            column_constraint_segment:
+              keyword: 'NULL'
+        - comma: ','
+        - column_definition:
+            identifier: DATE_LAST_INSERTED
+            data_type:
+              identifier: DATETIME
+            column_constraint_segment:
+              keyword: DEFAULT
+              function:
+                function_name:
+                  function_name_identifier: GETDATE
+                bracketed:
+                  start_bracket: (
+                  end_bracket: )
+        - comma: ','
+        - column_definition:
+            identifier: '[DATE_RANGE_START]'
+            data_type:
+              identifier: datetime
+        - comma: ','
+        - column_definition:
+            identifier: '[DATE_OF_REPORTS_LAG]'
+            data_type:
+              identifier: datetime
+        - comma: ','
+        - column_definition:
+            identifier: '[DATE_RANGE_START_LAG]'
+            data_type:
+              identifier: datetime
+        - comma: ','
+        - column_definition:
+            identifier: '[7D_AVERAGE_INFECTED_DAILY_INCREASE_TOTAL]'
+            data_type:
+              identifier: decimal
+              bracketed:
+              - start_bracket: (
+              - expression:
+                  literal: '16'
+              - comma: ','
+              - expression:
+                  literal: '2'
+              - end_bracket: )
+        - comma: ','
+        - column_definition:
+            identifier: '[7D_AVERAGE_INFECTED_DAILY_INCREASE_LAG]'
+            data_type:
+              identifier: decimal
+              bracketed:
+              - start_bracket: (
+              - expression:
+                  literal: '16'
+              - comma: ','
+              - expression:
+                  literal: '2'
+              - end_bracket: )
+        - comma: ','
+        - column_definition:
+            identifier: '[7D_AVERAGE_INFECTED_DAILY_INCREASE_ABSOLUTE]'
+            data_type:
+              identifier: decimal
+              bracketed:
+              - start_bracket: (
+              - expression:
+                  literal: '16'
+              - comma: ','
+              - expression:
+                  literal: '2'
+              - end_bracket: )
+        - end_bracket: )
+  - statement_terminator: ;
diff --git a/test/fixtures/parser/tsql/create_view.yml b/test/fixtures/parser/tsql/create_view.yml
index 63d9423dcb8..e0a7fb32002 100644
--- a/test/fixtures/parser/tsql/create_view.yml
+++ b/test/fixtures/parser/tsql/create_view.yml
@@ -3,77 +3,78 @@
 # computed by SQLFluff when running the tests. Please run
 # `python test/generate_parse_fixture_yml.py`  to generate them after adding or
 # altering SQL files.
-_hash: 032b7d1eb8b54681afe817df55d06345bc341b5afc6c42824940bd39d3fc70e3
+_hash: dd5bc831bfcf59b4eac75c4b19aaf1d7296fc810db987496b68404da34785c39
 file:
-  statement:
-    create_view_statement:
-    - keyword: CREATE
-    - binary_operator: OR
-    - keyword: ALTER
-    - keyword: VIEW
-    - object_reference:
-      - identifier: Sales
-      - dot: .
-      - identifier: SalesPersonPerform
-    - keyword: AS
-    - select_statement:
-        select_clause:
-        - keyword: SELECT
-        - select_clause_modifier:
-            keyword: TOP
-            bracketed:
-              start_bracket: (
-              expression:
-                literal: '100'
-              end_bracket: )
-        - select_clause_element:
-            column_reference:
-              identifier: SalesPersonID
-        - comma: ','
-        - select_clause_element:
-            function:
-              function_name:
-                function_name_identifier: SUM
+  batch:
+    statement:
+      create_view_statement:
+      - keyword: CREATE
+      - binary_operator: OR
+      - keyword: ALTER
+      - keyword: VIEW
+      - object_reference:
+        - identifier: Sales
+        - dot: .
+        - identifier: SalesPersonPerform
+      - keyword: AS
+      - select_statement:
+          select_clause:
+          - keyword: SELECT
+          - select_clause_modifier:
+              keyword: TOP
               bracketed:
                 start_bracket: (
                 expression:
-                  column_reference:
-                    identifier: TotalDue
+                  literal: '100'
                 end_bracket: )
-            alias_expression:
-              keyword: AS
-              identifier: TotalSales
-        from_clause:
-          keyword: FROM
-          from_expression:
-            from_expression_element:
-              table_expression:
-                table_reference:
-                - identifier: Sales
-                - dot: .
-                - identifier: SalesOrderHeader
-        where_clause:
-          keyword: WHERE
-          expression:
-            column_reference:
-              identifier: OrderDate
-            comparison_operator: '>'
-            function:
-              function_name:
-                keyword: CONVERT
-              bracketed:
-              - start_bracket: (
-              - data_type:
-                  identifier: DATETIME
-              - comma: ','
-              - expression:
-                  literal: "'20001231'"
-              - comma: ','
-              - expression:
-                  literal: '101'
-              - end_bracket: )
-        groupby_clause:
-        - keyword: GROUP
-        - keyword: BY
-        - column_reference:
-            identifier: SalesPersonID
+          - select_clause_element:
+              column_reference:
+                identifier: SalesPersonID
+          - comma: ','
+          - select_clause_element:
+              function:
+                function_name:
+                  function_name_identifier: SUM
+                bracketed:
+                  start_bracket: (
+                  expression:
+                    column_reference:
+                      identifier: TotalDue
+                  end_bracket: )
+              alias_expression:
+                keyword: AS
+                identifier: TotalSales
+          from_clause:
+            keyword: FROM
+            from_expression:
+              from_expression_element:
+                table_expression:
+                  table_reference:
+                  - identifier: Sales
+                  - dot: .
+                  - identifier: SalesOrderHeader
+          where_clause:
+            keyword: WHERE
+            expression:
+              column_reference:
+                identifier: OrderDate
+              comparison_operator: '>'
+              function:
+                function_name:
+                  keyword: CONVERT
+                bracketed:
+                - start_bracket: (
+                - data_type:
+                    identifier: DATETIME
+                - comma: ','
+                - expression:
+                    literal: "'20001231'"
+                - comma: ','
+                - expression:
+                    literal: '101'
+                - end_bracket: )
+          groupby_clause:
+          - keyword: GROUP
+          - keyword: BY
+          - column_reference:
+              identifier: SalesPersonID
diff --git a/test/fixtures/parser/tsql/create_view_with_cte.yml b/test/fixtures/parser/tsql/create_view_with_cte.yml
index 1db270344a8..1caf83dc866 100644
--- a/test/fixtures/parser/tsql/create_view_with_cte.yml
+++ b/test/fixtures/parser/tsql/create_view_with_cte.yml
@@ -3,137 +3,138 @@
 # computed by SQLFluff when running the tests. Please run
 # `python test/generate_parse_fixture_yml.py`  to generate them after adding or
 # altering SQL files.
-_hash: d2647d051261f19f1d85b209fe70b55e9b5bec8be7e6e42da004a94a45f4f5b0
+_hash: 763db78c08a0b4630b4226060c1f95d4c9396cf3f44e9f92054895fbc665158e
 file:
-  statement:
-    create_view_statement:
-    - keyword: CREATE
-    - keyword: VIEW
-    - object_reference:
-        identifier: vwCTE
-    - keyword: AS
-    - with_compound_statement:
-        keyword: WITH
-        common_table_expression:
-        - identifier: cte
-        - bracketed:
-            start_bracket: (
-            identifier_list:
-            - identifier: EmployeeID
-            - comma: ','
-            - identifier: ManagerID
-            - comma: ','
-            - identifier: Title
-            end_bracket: )
-        - keyword: AS
-        - bracketed:
-            start_bracket: (
-            set_expression:
-            - select_statement:
-                select_clause:
-                - keyword: SELECT
-                - select_clause_element:
-                    column_reference:
-                      identifier: EmployeeID
-                - comma: ','
-                - select_clause_element:
-                    column_reference:
-                      identifier: ManagerID
-                - comma: ','
-                - select_clause_element:
-                    column_reference:
-                      identifier: Title
-                from_clause:
-                  keyword: FROM
-                  from_expression:
-                    from_expression_element:
-                      table_expression:
-                        table_reference:
-                        - identifier: HumanResources
-                        - dot: .
-                        - identifier: Employee
-                where_clause:
-                  keyword: WHERE
-                  expression:
-                  - column_reference:
-                      identifier: ManagerID
-                  - keyword: IS
-                  - keyword: NOT
-                  - keyword: 'NULL'
-            - set_operator:
-              - keyword: UNION
-              - keyword: ALL
-            - select_statement:
-                select_clause:
-                - keyword: SELECT
-                - select_clause_element:
-                    column_reference:
-                    - identifier: cte
-                    - dot: .
-                    - identifier: EmployeeID
-                - comma: ','
-                - select_clause_element:
-                    column_reference:
-                    - identifier: cte
-                    - dot: .
-                    - identifier: ManagerID
-                - comma: ','
-                - select_clause_element:
-                    column_reference:
-                    - identifier: cte
-                    - dot: .
-                    - identifier: Title
-                from_clause:
-                  keyword: FROM
-                  from_expression:
-                    from_expression_element:
-                      table_expression:
-                        table_reference:
-                          identifier: cte
-                    join_clause:
-                      keyword: JOIN
+  batch:
+    statement:
+      create_view_statement:
+      - keyword: CREATE
+      - keyword: VIEW
+      - object_reference:
+          identifier: vwCTE
+      - keyword: AS
+      - with_compound_statement:
+          keyword: WITH
+          common_table_expression:
+          - identifier: cte
+          - bracketed:
+              start_bracket: (
+              identifier_list:
+              - identifier: EmployeeID
+              - comma: ','
+              - identifier: ManagerID
+              - comma: ','
+              - identifier: Title
+              end_bracket: )
+          - keyword: AS
+          - bracketed:
+              start_bracket: (
+              set_expression:
+              - select_statement:
+                  select_clause:
+                  - keyword: SELECT
+                  - select_clause_element:
+                      column_reference:
+                        identifier: EmployeeID
+                  - comma: ','
+                  - select_clause_element:
+                      column_reference:
+                        identifier: ManagerID
+                  - comma: ','
+                  - select_clause_element:
+                      column_reference:
+                        identifier: Title
+                  from_clause:
+                    keyword: FROM
+                    from_expression:
                       from_expression_element:
                         table_expression:
                           table_reference:
                           - identifier: HumanResources
                           - dot: .
                           - identifier: Employee
-                        alias_expression:
-                          keyword: AS
-                          identifier: e
-                      join_on_condition:
-                        keyword: 'ON'
-                        expression:
-                        - column_reference:
-                          - identifier: cte
-                          - dot: .
-                          - identifier: ManagerID
-                        - comparison_operator: '='
-                        - column_reference:
-                          - identifier: e
-                          - dot: .
-                          - identifier: EmployeeID
-            end_bracket: )
-        select_statement:
-          select_clause:
-          - keyword: SELECT
-          - select_clause_element:
-              column_reference:
-                identifier: EmployeeID
-          - comma: ','
-          - select_clause_element:
-              column_reference:
-                identifier: ManagerID
-          - comma: ','
-          - select_clause_element:
-              column_reference:
-                identifier: Title
-          from_clause:
-            keyword: FROM
-            from_expression:
-              from_expression_element:
-                table_expression:
-                  table_reference:
-                    identifier: cte
+                  where_clause:
+                    keyword: WHERE
+                    expression:
+                    - column_reference:
+                        identifier: ManagerID
+                    - keyword: IS
+                    - keyword: NOT
+                    - keyword: 'NULL'
+              - set_operator:
+                - keyword: UNION
+                - keyword: ALL
+              - select_statement:
+                  select_clause:
+                  - keyword: SELECT
+                  - select_clause_element:
+                      column_reference:
+                      - identifier: cte
+                      - dot: .
+                      - identifier: EmployeeID
+                  - comma: ','
+                  - select_clause_element:
+                      column_reference:
+                      - identifier: cte
+                      - dot: .
+                      - identifier: ManagerID
+                  - comma: ','
+                  - select_clause_element:
+                      column_reference:
+                      - identifier: cte
+                      - dot: .
+                      - identifier: Title
+                  from_clause:
+                    keyword: FROM
+                    from_expression:
+                      from_expression_element:
+                        table_expression:
+                          table_reference:
+                            identifier: cte
+                      join_clause:
+                        keyword: JOIN
+                        from_expression_element:
+                          table_expression:
+                            table_reference:
+                            - identifier: HumanResources
+                            - dot: .
+                            - identifier: Employee
+                          alias_expression:
+                            keyword: AS
+                            identifier: e
+                        join_on_condition:
+                          keyword: 'ON'
+                          expression:
+                          - column_reference:
+                            - identifier: cte
+                            - dot: .
+                            - identifier: ManagerID
+                          - comparison_operator: '='
+                          - column_reference:
+                            - identifier: e
+                            - dot: .
+                            - identifier: EmployeeID
+              end_bracket: )
+          select_statement:
+            select_clause:
+            - keyword: SELECT
+            - select_clause_element:
+                column_reference:
+                  identifier: EmployeeID
+            - comma: ','
+            - select_clause_element:
+                column_reference:
+                  identifier: ManagerID
+            - comma: ','
+            - select_clause_element:
+                column_reference:
+                  identifier: Title
+            from_clause:
+              keyword: FROM
+              from_expression:
+                from_expression_element:
+                  table_expression:
+                    table_reference:
+                      identifier: cte
   go_statement:
     keyword: GO
diff --git a/test/fixtures/parser/tsql/create_view_with_pivot.yml b/test/fixtures/parser/tsql/create_view_with_pivot.yml
index 46561d5c6c5..de130014884 100644
--- a/test/fixtures/parser/tsql/create_view_with_pivot.yml
+++ b/test/fixtures/parser/tsql/create_view_with_pivot.yml
@@ -3,113 +3,114 @@
 # computed by SQLFluff when running the tests. Please run
 # `python test/generate_parse_fixture_yml.py`  to generate them after adding or
 # altering SQL files.
-_hash: 2c729b9d77f53508b12ce1aab4176818e178c86ad01947ddf88011612e521f0d
+_hash: 89bcb60cefeae471d544c1e55a012a50d1b3289422bee1f4a3a6588d7f644677
 file:
-  statement:
-    create_view_statement:
-    - keyword: CREATE
-    - binary_operator: OR
-    - keyword: ALTER
-    - keyword: VIEW
-    - object_reference:
-      - identifier: DEST
-      - dot: .
-      - identifier: V_HOSPITAL_ADMISSIONS_OVERTIME_BYAGEGROUP
-    - keyword: AS
-    - select_statement:
-        select_clause:
-        - keyword: SELECT
-        - select_clause_element:
-            literal: "'AverageCost'"
-            alias_expression:
-              keyword: AS
-              identifier: Cost_Sorted_By_Production_Days
-        - comma: ','
-        - select_clause_element:
-            column_reference:
-              identifier: '[0]'
-        - comma: ','
-        - select_clause_element:
-            column_reference:
-              identifier: '[1]'
-        - comma: ','
-        - select_clause_element:
-            column_reference:
-              identifier: '[2]'
-        - comma: ','
-        - select_clause_element:
-            column_reference:
-              identifier: '[3]'
-        - comma: ','
-        - select_clause_element:
-            column_reference:
-              identifier: '[4]'
-        from_clause:
-          keyword: FROM
-          from_expression:
-            from_expression_element:
-              table_expression:
-                bracketed:
-                  start_bracket: (
-                  select_statement:
-                    select_clause:
-                    - keyword: SELECT
-                    - select_clause_element:
-                        column_reference:
-                          identifier: DaysToManufacture
-                    - comma: ','
-                    - select_clause_element:
-                        column_reference:
-                          identifier: StandardCost
-                    from_clause:
-                      keyword: FROM
-                      from_expression:
-                        from_expression_element:
-                          table_expression:
-                            table_reference:
-                            - identifier: Production
-                            - dot: .
-                            - identifier: Product
-                  end_bracket: )
+  batch:
+    statement:
+      create_view_statement:
+      - keyword: CREATE
+      - binary_operator: OR
+      - keyword: ALTER
+      - keyword: VIEW
+      - object_reference:
+        - identifier: DEST
+        - dot: .
+        - identifier: V_HOSPITAL_ADMISSIONS_OVERTIME_BYAGEGROUP
+      - keyword: AS
+      - select_statement:
+          select_clause:
+          - keyword: SELECT
+          - select_clause_element:
+              literal: "'AverageCost'"
               alias_expression:
                 keyword: AS
-                identifier: SourceTable
-        pivotunpivot_segment:
-        - keyword: PIVOT
-        - bracketed:
-          - start_bracket: (
-          - function:
-              function_name:
-                function_name_identifier: AVG
-              bracketed:
-                start_bracket: (
-                expression:
-                  column_reference:
-                    identifier: StandardCost
-                end_bracket: )
-          - keyword: FOR
-          - column_reference:
-              identifier: DaysToManufacture
-          - keyword: IN
-          - bracketed:
-            - start_bracket: (
-            - column_reference:
+                identifier: Cost_Sorted_By_Production_Days
+          - comma: ','
+          - select_clause_element:
+              column_reference:
                 identifier: '[0]'
-            - comma: ','
-            - column_reference:
+          - comma: ','
+          - select_clause_element:
+              column_reference:
                 identifier: '[1]'
-            - comma: ','
-            - column_reference:
+          - comma: ','
+          - select_clause_element:
+              column_reference:
                 identifier: '[2]'
-            - comma: ','
-            - column_reference:
+          - comma: ','
+          - select_clause_element:
+              column_reference:
                 identifier: '[3]'
-            - comma: ','
-            - column_reference:
+          - comma: ','
+          - select_clause_element:
+              column_reference:
                 identifier: '[4]'
+          from_clause:
+            keyword: FROM
+            from_expression:
+              from_expression_element:
+                table_expression:
+                  bracketed:
+                    start_bracket: (
+                    select_statement:
+                      select_clause:
+                      - keyword: SELECT
+                      - select_clause_element:
+                          column_reference:
+                            identifier: DaysToManufacture
+                      - comma: ','
+                      - select_clause_element:
+                          column_reference:
+                            identifier: StandardCost
+                      from_clause:
+                        keyword: FROM
+                        from_expression:
+                          from_expression_element:
+                            table_expression:
+                              table_reference:
+                              - identifier: Production
+                              - dot: .
+                              - identifier: Product
+                    end_bracket: )
+                alias_expression:
+                  keyword: AS
+                  identifier: SourceTable
+          pivotunpivot_segment:
+          - keyword: PIVOT
+          - bracketed:
+            - start_bracket: (
+            - function:
+                function_name:
+                  function_name_identifier: AVG
+                bracketed:
+                  start_bracket: (
+                  expression:
+                    column_reference:
+                      identifier: StandardCost
+                  end_bracket: )
+            - keyword: FOR
+            - column_reference:
+                identifier: DaysToManufacture
+            - keyword: IN
+            - bracketed:
+              - start_bracket: (
+              - column_reference:
+                  identifier: '[0]'
+              - comma: ','
+              - column_reference:
+                  identifier: '[1]'
+              - comma: ','
+              - column_reference:
+                  identifier: '[2]'
+              - comma: ','
+              - column_reference:
+                  identifier: '[3]'
+              - comma: ','
+              - column_reference:
+                  identifier: '[4]'
+              - end_bracket: )
             - end_bracket: )
-          - end_bracket: )
-        - keyword: AS
-        - table_reference:
-            identifier: PivotTable
-  statement_terminator: ;
+          - keyword: AS
+          - table_reference:
+              identifier: PivotTable
+    statement_terminator: ;
diff --git a/test/fixtures/parser/tsql/create_view_with_set_statements.yml b/test/fixtures/parser/tsql/create_view_with_set_statements.yml
index dda317e7658..c18957c7057 100644
--- a/test/fixtures/parser/tsql/create_view_with_set_statements.yml
+++ b/test/fixtures/parser/tsql/create_view_with_set_statements.yml
@@ -3,141 +3,144 @@
 # computed by SQLFluff when running the tests. Please run
 # `python test/generate_parse_fixture_yml.py`  to generate them after adding or
 # altering SQL files.
-_hash: 991916c7dbcaa79b28e8674ad765eb212b14601a5743ad37ae42e4c2c523658b
+_hash: 615826a0bb6f437bb9a9660b2717a7a573c6ac7baac9538e84598293dfa7762b
 file:
-- statement:
-    set_segment:
-    - keyword: SET
-    - keyword: ANSI_NULLS
-    - keyword: 'ON'
+- batch:
+    statement:
+      set_segment:
+      - keyword: SET
+      - keyword: ANSI_NULLS
+      - keyword: 'ON'
 - go_statement:
     keyword: GO
-- statement:
-    set_segment:
-    - keyword: SET
-    - keyword: QUOTED_IDENTIFIER
-    - keyword: 'ON'
+- batch:
+    statement:
+      set_segment:
+      - keyword: SET
+      - keyword: QUOTED_IDENTIFIER
+      - keyword: 'ON'
 - go_statement:
     keyword: GO
-- statement:
-    create_view_statement:
-    - keyword: CREATE
-    - binary_operator: OR
-    - keyword: ALTER
-    - keyword: VIEW
-    - object_reference:
-      - identifier: '[DEST]'
-      - dot: .
-      - identifier: '[V_DIFFERENCE_NURSING_HOME__INFECTED_LOCATIONS_TOTAL_PER_REGION]'
-    - keyword: AS
-    - select_statement:
-        select_clause:
-        - keyword: SELECT
-        - select_clause_element:
-            column_reference:
-              identifier: DATE_OF_REPORT
-        - comma: ','
-        - select_clause_element:
-            column_reference:
-              identifier: NEW_DATE_OF_REPORT_UNIX
-            alias_expression:
-              keyword: AS
-              identifier: NEW_DATE_UNIX
-        - comma: ','
-        - select_clause_element:
-            column_reference:
-              identifier: OLD_DATE_OF_REPORT_UNIX
-            alias_expression:
-              keyword: AS
-              identifier: OLD_DATE_UNIX
-        - comma: ','
-        - select_clause_element:
-            column_reference:
-            - identifier: T1
-            - dot: .
-            - identifier: VRCODE
-        - comma: ','
-        - select_clause_element:
-            expression:
-              case_expression:
-              - keyword: CASE
-              - keyword: WHEN
-              - expression:
-                - column_reference:
-                    identifier: OLD_VALUE
-                - keyword: IS
-                - keyword: 'NULL'
-              - keyword: THEN
-              - expression:
-                  literal: '0'
-              - keyword: ELSE
-              - expression:
-                  column_reference:
-                    identifier: OLD_VALUE
-              - keyword: END
-            alias_expression:
-              keyword: AS
-              identifier: OLD_VALUE
-        - comma: ','
-        - select_clause_element:
-            expression:
-              case_expression:
-              - keyword: CASE
-              - keyword: WHEN
-              - expression:
-                - column_reference:
-                    identifier: '[DIFFERENCE]'
-                - keyword: IS
-                - keyword: 'NULL'
-              - keyword: THEN
-              - expression:
-                  literal: '0'
-              - keyword: ELSE
-              - expression:
-                  column_reference:
-                    identifier: '[DIFFERENCE]'
-              - keyword: END
-            alias_expression:
-              keyword: AS
-              identifier: '[DIFFERENCE]'
-        from_clause:
-          keyword: FROM
-          from_expression:
-            from_expression_element:
-              table_expression:
-                table_reference:
-                  identifier: BASE_CTE
+- batch:
+    statement:
+      create_view_statement:
+      - keyword: CREATE
+      - binary_operator: OR
+      - keyword: ALTER
+      - keyword: VIEW
+      - object_reference:
+        - identifier: '[DEST]'
+        - dot: .
+        - identifier: '[V_DIFFERENCE_NURSING_HOME__INFECTED_LOCATIONS_TOTAL_PER_REGION]'
+      - keyword: AS
+      - select_statement:
+          select_clause:
+          - keyword: SELECT
+          - select_clause_element:
+              column_reference:
+                identifier: DATE_OF_REPORT
+          - comma: ','
+          - select_clause_element:
+              column_reference:
+                identifier: NEW_DATE_OF_REPORT_UNIX
+              alias_expression:
+                keyword: AS
+                identifier: NEW_DATE_UNIX
+          - comma: ','
+          - select_clause_element:
+              column_reference:
+                identifier: OLD_DATE_OF_REPORT_UNIX
               alias_expression:
-                identifier: T1
-            join_clause:
-            - keyword: LEFT
-            - keyword: JOIN
-            - from_expression_element:
+                keyword: AS
+                identifier: OLD_DATE_UNIX
+          - comma: ','
+          - select_clause_element:
+              column_reference:
+              - identifier: T1
+              - dot: .
+              - identifier: VRCODE
+          - comma: ','
+          - select_clause_element:
+              expression:
+                case_expression:
+                - keyword: CASE
+                - keyword: WHEN
+                - expression:
+                  - column_reference:
+                      identifier: OLD_VALUE
+                  - keyword: IS
+                  - keyword: 'NULL'
+                - keyword: THEN
+                - expression:
+                    literal: '0'
+                - keyword: ELSE
+                - expression:
+                    column_reference:
+                      identifier: OLD_VALUE
+                - keyword: END
+              alias_expression:
+                keyword: AS
+                identifier: OLD_VALUE
+          - comma: ','
+          - select_clause_element:
+              expression:
+                case_expression:
+                - keyword: CASE
+                - keyword: WHEN
+                - expression:
+                  - column_reference:
+                      identifier: '[DIFFERENCE]'
+                  - keyword: IS
+                  - keyword: 'NULL'
+                - keyword: THEN
+                - expression:
+                    literal: '0'
+                - keyword: ELSE
+                - expression:
+                    column_reference:
+                      identifier: '[DIFFERENCE]'
+                - keyword: END
+              alias_expression:
+                keyword: AS
+                identifier: '[DIFFERENCE]'
+          from_clause:
+            keyword: FROM
+            from_expression:
+              from_expression_element:
                 table_expression:
                   table_reference:
-                    identifier: LAST_DATE_OF_REPORT
+                    identifier: BASE_CTE
                 alias_expression:
-                  identifier: T2
-            - join_on_condition:
-                keyword: 'ON'
-                expression:
-                - column_reference:
-                  - identifier: T1
-                  - dot: .
-                  - identifier: '[VRCODE]'
-                - comparison_operator: '='
-                - column_reference:
-                  - identifier: T2
-                  - dot: .
-                  - identifier: '[VRCODE]'
-        where_clause:
-          keyword: WHERE
-          expression:
-          - column_reference:
-              identifier: DATE_OF_REPORT
-          - comparison_operator: '='
-          - column_reference:
-              identifier: LAST_DATE_OF_REPORT
-- statement_terminator: ;
+                  identifier: T1
+              join_clause:
+              - keyword: LEFT
+              - keyword: JOIN
+              - from_expression_element:
+                  table_expression:
+                    table_reference:
+                      identifier: LAST_DATE_OF_REPORT
+                  alias_expression:
+                    identifier: T2
+              - join_on_condition:
+                  keyword: 'ON'
+                  expression:
+                  - column_reference:
+                    - identifier: T1
+                    - dot: .
+                    - identifier: '[VRCODE]'
+                  - comparison_operator: '='
+                  - column_reference:
+                    - identifier: T2
+                    - dot: .
+                    - identifier: '[VRCODE]'
+          where_clause:
+            keyword: WHERE
+            expression:
+            - column_reference:
+                identifier: DATE_OF_REPORT
+            - comparison_operator: '='
+            - column_reference:
+                identifier: LAST_DATE_OF_REPORT
+    statement_terminator: ;
 - go_statement:
     keyword: GO
diff --git a/test/fixtures/parser/tsql/create_view_with_unpivot.yml b/test/fixtures/parser/tsql/create_view_with_unpivot.yml
index 118a14f999f..83147e77c37 100644
--- a/test/fixtures/parser/tsql/create_view_with_unpivot.yml
+++ b/test/fixtures/parser/tsql/create_view_with_unpivot.yml
@@ -3,101 +3,102 @@
 # computed by SQLFluff when running the tests. Please run
 # `python test/generate_parse_fixture_yml.py`  to generate them after adding or
 # altering SQL files.
-_hash: 8ffff6eb34e478b2f5a6938254e28c9adf414355f341149161beb12f2e00de54
+_hash: 92b083ebe9e52d47b2107b41ea7b5ebcec4dc4e9d3131f950a8a67f51035158b
 file:
-  statement:
-    create_view_statement:
-    - keyword: CREATE
-    - keyword: VIEW
-    - object_reference:
-        identifier: UnpivotView
-    - keyword: AS
-    - select_statement:
-        select_clause:
-        - keyword: SELECT
-        - select_clause_element:
-            column_reference:
-              identifier: VendorID
-        - comma: ','
-        - select_clause_element:
-            column_reference:
-              identifier: Employee
-        - comma: ','
-        - select_clause_element:
-            column_reference:
-              identifier: Orders
-        from_clause:
-          keyword: FROM
-          from_expression:
-            from_expression_element:
-              table_expression:
-                bracketed:
-                  start_bracket: (
-                  select_statement:
-                    select_clause:
-                    - keyword: SELECT
-                    - select_clause_element:
-                        column_reference:
-                          identifier: VendorID
-                    - comma: ','
-                    - select_clause_element:
-                        column_reference:
-                          identifier: Emp1
-                    - comma: ','
-                    - select_clause_element:
-                        column_reference:
-                          identifier: Emp2
-                    - comma: ','
-                    - select_clause_element:
-                        column_reference:
-                          identifier: Emp3
-                    - comma: ','
-                    - select_clause_element:
-                        column_reference:
-                          identifier: Emp4
-                    - comma: ','
-                    - select_clause_element:
-                        column_reference:
-                          identifier: Emp5
-                    from_clause:
-                      keyword: FROM
-                      from_expression:
-                        from_expression_element:
-                          table_expression:
-                            table_reference:
-                              identifier: pvt
-                  end_bracket: )
-              alias_expression:
-                identifier: p
-        pivotunpivot_segment:
-        - keyword: UNPIVOT
-        - bracketed:
-          - start_bracket: (
-          - column_reference:
-              identifier: Orders
-          - keyword: FOR
-          - column_reference:
-              identifier: Employee
-          - keyword: IN
+  batch:
+    statement:
+      create_view_statement:
+      - keyword: CREATE
+      - keyword: VIEW
+      - object_reference:
+          identifier: UnpivotView
+      - keyword: AS
+      - select_statement:
+          select_clause:
+          - keyword: SELECT
+          - select_clause_element:
+              column_reference:
+                identifier: VendorID
+          - comma: ','
+          - select_clause_element:
+              column_reference:
+                identifier: Employee
+          - comma: ','
+          - select_clause_element:
+              column_reference:
+                identifier: Orders
+          from_clause:
+            keyword: FROM
+            from_expression:
+              from_expression_element:
+                table_expression:
+                  bracketed:
+                    start_bracket: (
+                    select_statement:
+                      select_clause:
+                      - keyword: SELECT
+                      - select_clause_element:
+                          column_reference:
+                            identifier: VendorID
+                      - comma: ','
+                      - select_clause_element:
+                          column_reference:
+                            identifier: Emp1
+                      - comma: ','
+                      - select_clause_element:
+                          column_reference:
+                            identifier: Emp2
+                      - comma: ','
+                      - select_clause_element:
+                          column_reference:
+                            identifier: Emp3
+                      - comma: ','
+                      - select_clause_element:
+                          column_reference:
+                            identifier: Emp4
+                      - comma: ','
+                      - select_clause_element:
+                          column_reference:
+                            identifier: Emp5
+                      from_clause:
+                        keyword: FROM
+                        from_expression:
+                          from_expression_element:
+                            table_expression:
+                              table_reference:
+                                identifier: pvt
+                    end_bracket: )
+                alias_expression:
+                  identifier: p
+          pivotunpivot_segment:
+          - keyword: UNPIVOT
           - bracketed:
             - start_bracket: (
             - column_reference:
-                identifier: Emp1
-            - comma: ','
+                identifier: Orders
+            - keyword: FOR
             - column_reference:
-                identifier: Emp2
-            - comma: ','
-            - column_reference:
-                identifier: Emp3
-            - comma: ','
-            - column_reference:
-                identifier: Emp4
-            - comma: ','
-            - column_reference:
-                identifier: Emp5
+                identifier: Employee
+            - keyword: IN
+            - bracketed:
+              - start_bracket: (
+              - column_reference:
+                  identifier: Emp1
+              - comma: ','
+              - column_reference:
+                  identifier: Emp2
+              - comma: ','
+              - column_reference:
+                  identifier: Emp3
+              - comma: ','
+              - column_reference:
+                  identifier: Emp4
+              - comma: ','
+              - column_reference:
+                  identifier: Emp5
+              - end_bracket: )
             - end_bracket: )
-          - end_bracket: )
-        - keyword: AS
-        - table_reference:
-            identifier: unpvt
-  statement_terminator: ;
+          - keyword: AS
+          - table_reference:
+              identifier: unpvt
+    statement_terminator: ;
diff --git a/test/fixtures/parser/tsql/cte_s.yml b/test/fixtures/parser/tsql/cte_s.yml
index 3c0002d424b..0d82fc148f4 100644
--- a/test/fixtures/parser/tsql/cte_s.yml
+++ b/test/fixtures/parser/tsql/cte_s.yml
@@ -3,82 +3,83 @@
 # computed by SQLFluff when running the tests. Please run
 # `python test/generate_parse_fixture_yml.py`  to generate them after adding or
 # altering SQL files.
-_hash: a011f41e268e7cdb399c35525404e6dadcde9e6752bac3bf8d54d453a7b12a47
+_hash: 1281cc966ce84538a5bee498fda3df69087f70a51e8297cc2fcc854d76cb7d97
 file:
-  statement:
-    with_compound_statement:
-      keyword: WITH
-      common_table_expression:
-      - identifier: Sales_CTE
-      - bracketed:
-          start_bracket: (
-          identifier_list:
-          - identifier: SalesPersonID
-          - comma: ','
-          - identifier: NumberOfOrders
-          end_bracket: )
-      - keyword: AS
-      - bracketed:
-          start_bracket: (
-          select_statement:
-            select_clause:
-            - keyword: SELECT
-            - select_clause_element:
-                column_reference:
-                  identifier: SalesPersonID
+  batch:
+    statement:
+      with_compound_statement:
+        keyword: WITH
+        common_table_expression:
+        - identifier: Sales_CTE
+        - bracketed:
+            start_bracket: (
+            identifier_list:
+            - identifier: SalesPersonID
             - comma: ','
-            - select_clause_element:
-                function:
-                  function_name:
-                    function_name_identifier: COUNT
-                  bracketed:
-                    start_bracket: (
-                    star: '*'
-                    end_bracket: )
-            from_clause:
-              keyword: FROM
-              from_expression:
-                from_expression_element:
-                  table_expression:
-                    table_reference:
-                    - identifier: Sales
-                    - dot: .
-                    - identifier: SalesOrderHeader
-            where_clause:
-              keyword: WHERE
-              expression:
+            - identifier: NumberOfOrders
+            end_bracket: )
+        - keyword: AS
+        - bracketed:
+            start_bracket: (
+            select_statement:
+              select_clause:
+              - keyword: SELECT
+              - select_clause_element:
+                  column_reference:
+                    identifier: SalesPersonID
+              - comma: ','
+              - select_clause_element:
+                  function:
+                    function_name:
+                      function_name_identifier: COUNT
+                    bracketed:
+                      start_bracket: (
+                      star: '*'
+                      end_bracket: )
+              from_clause:
+                keyword: FROM
+                from_expression:
+                  from_expression_element:
+                    table_expression:
+                      table_reference:
+                      - identifier: Sales
+                      - dot: .
+                      - identifier: SalesOrderHeader
+              where_clause:
+                keyword: WHERE
+                expression:
+                - column_reference:
+                    identifier: SalesPersonID
+                - keyword: IS
+                - keyword: NOT
+                - keyword: 'NULL'
+              groupby_clause:
+              - keyword: GROUP
+              - keyword: BY
               - column_reference:
                   identifier: SalesPersonID
-              - keyword: IS
-              - keyword: NOT
-              - keyword: 'NULL'
-            groupby_clause:
-            - keyword: GROUP
-            - keyword: BY
-            - column_reference:
-                identifier: SalesPersonID
-          end_bracket: )
-      select_statement:
-        select_clause:
-          keyword: SELECT
-          select_clause_element:
-            function:
-              function_name:
-                function_name_identifier: AVG
-              bracketed:
-                start_bracket: (
-                expression:
-                  column_reference:
-                    identifier: NumberOfOrders
-                end_bracket: )
-            alias_expression:
-              keyword: AS
-              identifier: '"Average Sales Per Person"'
-        from_clause:
-          keyword: FROM
-          from_expression:
-            from_expression_element:
-              table_expression:
-                table_reference:
-                  identifier: Sales_CTE
-  statement_terminator: ;
+            end_bracket: )
+        select_statement:
+          select_clause:
+            keyword: SELECT
+            select_clause_element:
+              function:
+                function_name:
+                  function_name_identifier: AVG
+                bracketed:
+                  start_bracket: (
+                  expression:
+                    column_reference:
+                      identifier: NumberOfOrders
+                  end_bracket: )
+              alias_expression:
+                keyword: AS
+                identifier: '"Average Sales Per Person"'
+          from_clause:
+            keyword: FROM
+            from_expression:
+              from_expression_element:
+                table_expression:
+                  table_reference:
+                    identifier: Sales_CTE
+    statement_terminator: ;
diff --git a/test/fixtures/parser/tsql/function_with_variable.yml b/test/fixtures/parser/tsql/function_with_variable.yml
index 4efcc7636ac..5e36cd7e919 100644
--- a/test/fixtures/parser/tsql/function_with_variable.yml
+++ b/test/fixtures/parser/tsql/function_with_variable.yml
@@ -3,46 +3,47 @@
 # computed by SQLFluff when running the tests. Please run
 # `python test/generate_parse_fixture_yml.py`  to generate them after adding or
 # altering SQL files.
-_hash: d4f268aa332b57217684bae77a6bc2c50b64a318f591b78124a5bd47c79c55f5
+_hash: 367aba2305179b06005826f62924fca7b7261ff612f1fceb6181ee1c4de67799
 file:
-  statement:
-    create_function_statement:
-    - keyword: CREATE
-    - binary_operator: OR
-    - keyword: ALTER
-    - keyword: FUNCTION
-    - object_reference:
-      - identifier: '[dbo]'
-      - dot: .
-      - identifier: '[CONVERT_ISO_WEEK_TO_UNIX]'
-    - base:
-        bracketed:
-        - start_bracket: (
-        - parameter: '@year'
-        - data_type:
-            identifier: INT
-        - comma: ','
-        - parameter: '@week'
-        - data_type:
-            identifier: INT
-        - end_bracket: )
-    - keyword: RETURNS
-    - data_type:
-        identifier: BIGINT
-    - function_statement:
-      - keyword: AS
-      - raw: BEGIN
-      - raw: DECLARE
-      - raw: '@result'
-      - raw: BIGINT
-      - raw: SET
-      - raw: '@result'
-      - raw: '='
-      - raw: '4'
-      - raw: RETURN
-      - raw: '@result'
-      - raw: +
-      - raw: '@year'
-      - raw: +
-      - raw: '@week'
-      - raw: END
+  batch:
+    statement:
+      create_function_statement:
+      - keyword: CREATE
+      - binary_operator: OR
+      - keyword: ALTER
+      - keyword: FUNCTION
+      - object_reference:
+        - identifier: '[dbo]'
+        - dot: .
+        - identifier: '[CONVERT_ISO_WEEK_TO_UNIX]'
+      - base:
+          bracketed:
+          - start_bracket: (
+          - parameter: '@year'
+          - data_type:
+              identifier: INT
+          - comma: ','
+          - parameter: '@week'
+          - data_type:
+              identifier: INT
+          - end_bracket: )
+      - keyword: RETURNS
+      - data_type:
+          identifier: BIGINT
+      - function_statement:
+        - keyword: AS
+        - raw: BEGIN
+        - raw: DECLARE
+        - raw: '@result'
+        - raw: BIGINT
+        - raw: SET
+        - raw: '@result'
+        - raw: '='
+        - raw: '4'
+        - raw: RETURN
+        - raw: '@result'
+        - raw: +
+        - raw: '@year'
+        - raw: +
+        - raw: '@week'
+        - raw: END
diff --git a/test/fixtures/parser/tsql/functions_a.yml b/test/fixtures/parser/tsql/functions_a.yml
index 708b7e168d4..d497ae58af4 100644
--- a/test/fixtures/parser/tsql/functions_a.yml
+++ b/test/fixtures/parser/tsql/functions_a.yml
@@ -3,126 +3,127 @@
 # computed by SQLFluff when running the tests. Please run
 # `python test/generate_parse_fixture_yml.py`  to generate them after adding or
 # altering SQL files.
-_hash: 8e9c75abdc6fcde3d529baeb1647f1d5ab28f83dc54dd56f8119393e3ebbda82
+_hash: 252a3ff7798b62db9d272e79c7651940dc7c78d01d9b12d4a373791856ce0b7f
 file:
-  statement:
-    select_statement:
-      select_clause:
-      - keyword: SELECT
-      - select_clause_element:
-          function:
-            function_name:
-              function_name_identifier: DATE
-            bracketed:
-              start_bracket: (
-              expression:
-                column_reference:
-                  identifier: t
-              end_bracket: )
-          alias_expression:
-            keyword: AS
-            identifier: t_date
-      - comma: ','
-      - select_clause_element:
-          function:
-            function_name:
-              function_name_identifier: ROUND
-            bracketed:
-            - start_bracket: (
-            - expression:
-                column_reference:
-                  identifier: b
-            - comma: ','
-            - expression:
-                literal: '2'
-            - end_bracket: )
-          alias_expression:
-            keyword: AS
-            identifier: b_round
-      - comma: ','
-      - select_clause_element:
-          function:
-            function_name:
-              function_name_identifier: LEFT
-            bracketed:
-            - start_bracket: (
-            - expression:
-                function:
-                  function_name:
-                    function_name_identifier: RIGHT
-                  bracketed:
-                  - start_bracket: (
-                  - expression:
-                      column_reference:
-                        identifier: s
-                  - comma: ','
-                  - expression:
-                      literal: '5'
-                  - end_bracket: )
-            - comma: ','
-            - expression:
-                function:
-                  function_name:
-                    function_name_identifier: LEN
-                  bracketed:
-                    start_bracket: (
-                    expression:
-                      column_reference:
-                        identifier: s
-                      binary_operator: +
-                      literal: '6'
-                    end_bracket: )
-            - end_bracket: )
-          alias_expression:
-            keyword: AS
-            identifier: compound
-      - comma: ','
-      - select_clause_element:
-          function:
-            function_name:
-              keyword: DATEADD
-            bracketed:
-            - start_bracket: (
-            - date_part:
-                keyword: month
-            - comma: ','
-            - expression:
-                numeric_literal:
-                  binary_operator: '-'
-                  literal: '1'
-            - comma: ','
-            - expression:
-                column_reference:
-                  identifier: column1
-            - end_bracket: )
-          alias_expression:
-            keyword: AS
-            identifier: column1_lastmonth
-      - comma: ','
-      - select_clause_element:
-          function:
-            function_name:
-              keyword: convert
-            bracketed:
-            - start_bracket: (
-            - data_type:
-                identifier: varchar
-            - comma: ','
-            - data_type:
-              - identifier: tbl_b
-              - dot: .
-              - identifier: column1
-            - comma: ','
-            - expression:
-                literal: '23'
-            - end_bracket: )
-          alias_expression:
-            keyword: AS
-            identifier: column1_varchar
-      from_clause:
-        keyword: FROM
-        from_expression:
-          from_expression_element:
-            table_expression:
-              table_reference:
-                identifier: tbl_b
+  batch:
+    statement:
+      select_statement:
+        select_clause:
+        - keyword: SELECT
+        - select_clause_element:
+            function:
+              function_name:
+                function_name_identifier: DATE
+              bracketed:
+                start_bracket: (
+                expression:
+                  column_reference:
+                    identifier: t
+                end_bracket: )
+            alias_expression:
+              keyword: AS
+              identifier: t_date
+        - comma: ','
+        - select_clause_element:
+            function:
+              function_name:
+                function_name_identifier: ROUND
+              bracketed:
+              - start_bracket: (
+              - expression:
+                  column_reference:
+                    identifier: b
+              - comma: ','
+              - expression:
+                  literal: '2'
+              - end_bracket: )
+            alias_expression:
+              keyword: AS
+              identifier: b_round
+        - comma: ','
+        - select_clause_element:
+            function:
+              function_name:
+                function_name_identifier: LEFT
+              bracketed:
+              - start_bracket: (
+              - expression:
+                  function:
+                    function_name:
+                      function_name_identifier: RIGHT
+                    bracketed:
+                    - start_bracket: (
+                    - expression:
+                        column_reference:
+                          identifier: s
+                    - comma: ','
+                    - expression:
+                        literal: '5'
+                    - end_bracket: )
+              - comma: ','
+              - expression:
+                  function:
+                    function_name:
+                      function_name_identifier: LEN
+                    bracketed:
+                      start_bracket: (
+                      expression:
+                        column_reference:
+                          identifier: s
+                        binary_operator: +
+                        literal: '6'
+                      end_bracket: )
+              - end_bracket: )
+            alias_expression:
+              keyword: AS
+              identifier: compound
+        - comma: ','
+        - select_clause_element:
+            function:
+              function_name:
+                keyword: DATEADD
+              bracketed:
+              - start_bracket: (
+              - date_part:
+                  keyword: month
+              - comma: ','
+              - expression:
+                  numeric_literal:
+                    binary_operator: '-'
+                    literal: '1'
+              - comma: ','
+              - expression:
+                  column_reference:
+                    identifier: column1
+              - end_bracket: )
+            alias_expression:
+              keyword: AS
+              identifier: column1_lastmonth
+        - comma: ','
+        - select_clause_element:
+            function:
+              function_name:
+                keyword: convert
+              bracketed:
+              - start_bracket: (
+              - data_type:
+                  identifier: varchar
+              - comma: ','
+              - data_type:
+                - identifier: tbl_b
+                - dot: .
+                - identifier: column1
+              - comma: ','
+              - expression:
+                  literal: '23'
+              - end_bracket: )
+            alias_expression:
+              keyword: AS
+              identifier: column1_varchar
+        from_clause:
+          keyword: FROM
+          from_expression:
+            from_expression_element:
+              table_expression:
+                table_reference:
+                  identifier: tbl_b
diff --git a/test/fixtures/parser/tsql/insert_statement.yml b/test/fixtures/parser/tsql/insert_statement.yml
index 51fcbf6b2ba..b64d33925f1 100644
--- a/test/fixtures/parser/tsql/insert_statement.yml
+++ b/test/fixtures/parser/tsql/insert_statement.yml
@@ -3,263 +3,264 @@
 # computed by SQLFluff when running the tests. Please run
 # `python test/generate_parse_fixture_yml.py`  to generate them after adding or
 # altering SQL files.
-_hash: c6d8a59c3f9ea8a2e878454768495b3ce9ffb6970125bf69fe9c97eb815a0996
+_hash: d3aeeda4d580f92ff80b7dfaac287a961f4aff8ec4ae8263dbe2f27da395d0f2
 file:
-  statement:
-    insert_statement:
-    - keyword: INSERT
-    - keyword: INTO
-    - table_reference:
-      - identifier: INTER
-      - dot: .
-      - identifier: ECDC_CASES
-    - bracketed:
-      - start_bracket: (
-      - column_reference:
-          identifier: '[COUNTRY]'
-      - comma: ','
-      - column_reference:
-          identifier: '[COUNTRY_CODE]'
-      - comma: ','
-      - column_reference:
-          identifier: '[CONTINENT]'
-      - comma: ','
-      - column_reference:
-          identifier: '[POPULATION]'
-      - comma: ','
-      - column_reference:
-          identifier: '[INDICATOR]'
-      - comma: ','
-      - column_reference:
-          identifier: '[WEEKLY_COUNT]'
-      - comma: ','
-      - column_reference:
-          identifier: '[YEAR_WEEK]'
-      - comma: ','
-      - column_reference:
-          identifier: '[WEEK_START]'
-      - comma: ','
-      - column_reference:
-          identifier: '[WEEK_END]'
-      - comma: ','
-      - column_reference:
-          identifier: '[RATE_14_DAY]'
-      - comma: ','
-      - column_reference:
-          identifier: '[CUMULATIVE_COUNT]'
-      - comma: ','
-      - column_reference:
-          identifier: '[SOURCE]'
-      - end_bracket: )
-    - select_statement:
-        select_clause:
-        - keyword: SELECT
-        - select_clause_element:
-            column_reference:
-              identifier: '[COUNTRY]'
+  batch:
+    statement:
+      insert_statement:
+      - keyword: INSERT
+      - keyword: INTO
+      - table_reference:
+        - identifier: INTER
+        - dot: .
+        - identifier: ECDC_CASES
+      - bracketed:
+        - start_bracket: (
+        - column_reference:
+            identifier: '[COUNTRY]'
         - comma: ','
-        - select_clause_element:
-            column_reference:
-              identifier: '[COUNTRY_CODE]'
+        - column_reference:
+            identifier: '[COUNTRY_CODE]'
         - comma: ','
-        - select_clause_element:
-            column_reference:
-              identifier: '[CONTINENT]'
+        - column_reference:
+            identifier: '[CONTINENT]'
         - comma: ','
-        - select_clause_element:
-            function:
-              function_name:
-                function_name_identifier: CAST
-              bracketed:
-                start_bracket: (
-                expression:
-                  column_reference:
-                    identifier: '[POPULATION]'
-                keyword: AS
-                data_type:
-                  identifier: BIGINT
-                end_bracket: )
-            alias_expression:
-              keyword: AS
-              identifier: '[POPULATION]'
+        - column_reference:
+            identifier: '[POPULATION]'
         - comma: ','
-        - select_clause_element:
-            column_reference:
-              identifier: '[INDICATOR]'
+        - column_reference:
+            identifier: '[INDICATOR]'
         - comma: ','
-        - select_clause_element:
-            function:
-              function_name:
-                function_name_identifier: CAST
-              bracketed:
-                start_bracket: (
-                expression:
-                  column_reference:
-                    identifier: '[WEEKLY_COUNT]'
-                keyword: AS
-                data_type:
-                  identifier: BIGINT
-                end_bracket: )
-            alias_expression:
-              keyword: AS
-              identifier: '[WEEKLY_COUNT]'
+        - column_reference:
+            identifier: '[WEEKLY_COUNT]'
         - comma: ','
-        - select_clause_element:
-            column_reference:
-              identifier: '[YEAR_WEEK]'
+        - column_reference:
+            identifier: '[YEAR_WEEK]'
         - comma: ','
-        - select_clause_element:
-            function:
-              function_name:
-                function_name_identifier: CAST
-              bracketed:
-                start_bracket: (
-                expression:
-                  function:
-                    function_name:
-                      identifier: '[dbo]'
-                      dot: .
-                      function_name_identifier: '[CONVERT_ISO_WEEK_TO_DATETIME]'
-                    bracketed:
-                    - start_bracket: (
-                    - expression:
-                        function:
-                          function_name:
-                            function_name_identifier: LEFT
-                          bracketed:
-                          - start_bracket: (
-                          - expression:
-                              column_reference:
-                                identifier: YEAR_WEEK
-                          - comma: ','
-                          - expression:
-                              literal: '4'
-                          - end_bracket: )
-                    - comma: ','
-                    - expression:
-                        function:
-                          function_name:
-                            function_name_identifier: RIGHT
-                          bracketed:
-                          - start_bracket: (
-                          - expression:
-                              column_reference:
-                                identifier: YEAR_WEEK
-                          - comma: ','
-                          - expression:
-                              literal: '2'
-                          - end_bracket: )
-                    - end_bracket: )
-                keyword: AS
-                data_type:
-                  identifier: DATE
-                end_bracket: )
-            alias_expression:
-              keyword: AS
-              identifier: '[WEEK_START]'
+        - column_reference:
+            identifier: '[WEEK_START]'
         - comma: ','
-        - select_clause_element:
-            function:
-              function_name:
-                function_name_identifier: CAST
-              bracketed:
-                start_bracket: (
-                expression:
-                  function:
-                    function_name:
-                      identifier: '[dbo]'
-                      dot: .
-                      function_name_identifier: '[WEEK_END]'
-                    bracketed:
-                      start_bracket: (
-                      expression:
-                        function:
-                          function_name:
-                            identifier: '[dbo]'
-                            dot: .
-                            function_name_identifier: '[CONVERT_ISO_WEEK_TO_DATETIME]'
-                          bracketed:
-                          - start_bracket: (
-                          - expression:
-                              function:
-                                function_name:
-                                  function_name_identifier: LEFT
-                                bracketed:
-                                - start_bracket: (
-                                - expression:
-                                    column_reference:
-                                      identifier: YEAR_WEEK
-                                - comma: ','
-                                - expression:
-                                    literal: '4'
-                                - end_bracket: )
-                          - comma: ','
-                          - expression:
-                              function:
-                                function_name:
-                                  function_name_identifier: RIGHT
-                                bracketed:
-                                - start_bracket: (
-                                - expression:
-                                    column_reference:
-                                      identifier: YEAR_WEEK
-                                - comma: ','
-                                - expression:
-                                    literal: '2'
-                                - end_bracket: )
-                          - end_bracket: )
-                      end_bracket: )
-                keyword: AS
-                data_type:
-                  identifier: DATE
-                end_bracket: )
-            alias_expression:
-              keyword: AS
-              identifier: '[WEEK_END]'
+        - column_reference:
+            identifier: '[WEEK_END]'
         - comma: ','
-        - select_clause_element:
-            function:
-              function_name:
-                function_name_identifier: CAST
-              bracketed:
-                start_bracket: (
-                expression:
-                  column_reference:
-                    identifier: '[RATE_14_DAY]'
-                keyword: AS
-                data_type:
-                  identifier: FLOAT
-                end_bracket: )
-            alias_expression:
-              keyword: AS
-              identifier: '[RATE_14_DAY]'
+        - column_reference:
+            identifier: '[RATE_14_DAY]'
         - comma: ','
-        - select_clause_element:
-            function:
-              function_name:
-                function_name_identifier: CAST
-              bracketed:
-                start_bracket: (
-                expression:
-                  column_reference:
-                    identifier: '[CUMULATIVE_COUNT]'
-                keyword: AS
-                data_type:
-                  identifier: BIGINT
-                end_bracket: )
-            alias_expression:
-              keyword: AS
-              identifier: '[CUMULATIVE_COUNT]'
+        - column_reference:
+            identifier: '[CUMULATIVE_COUNT]'
         - comma: ','
-        - select_clause_element:
-            column_reference:
-              identifier: '[SOURCE]'
-        from_clause:
-          keyword: FROM
-          from_expression:
-            from_expression_element:
-              table_expression:
-                table_reference:
-                - identifier: STAGE
-                - dot: .
-                - identifier: ECDC_CASES
+        - column_reference:
+            identifier: '[SOURCE]'
+        - end_bracket: )
+      - select_statement:
+          select_clause:
+          - keyword: SELECT
+          - select_clause_element:
+              column_reference:
+                identifier: '[COUNTRY]'
+          - comma: ','
+          - select_clause_element:
+              column_reference:
+                identifier: '[COUNTRY_CODE]'
+          - comma: ','
+          - select_clause_element:
+              column_reference:
+                identifier: '[CONTINENT]'
+          - comma: ','
+          - select_clause_element:
+              function:
+                function_name:
+                  function_name_identifier: CAST
+                bracketed:
+                  start_bracket: (
+                  expression:
+                    column_reference:
+                      identifier: '[POPULATION]'
+                  keyword: AS
+                  data_type:
+                    identifier: BIGINT
+                  end_bracket: )
+              alias_expression:
+                keyword: AS
+                identifier: '[POPULATION]'
+          - comma: ','
+          - select_clause_element:
+              column_reference:
+                identifier: '[INDICATOR]'
+          - comma: ','
+          - select_clause_element:
+              function:
+                function_name:
+                  function_name_identifier: CAST
+                bracketed:
+                  start_bracket: (
+                  expression:
+                    column_reference:
+                      identifier: '[WEEKLY_COUNT]'
+                  keyword: AS
+                  data_type:
+                    identifier: BIGINT
+                  end_bracket: )
+              alias_expression:
+                keyword: AS
+                identifier: '[WEEKLY_COUNT]'
+          - comma: ','
+          - select_clause_element:
+              column_reference:
+                identifier: '[YEAR_WEEK]'
+          - comma: ','
+          - select_clause_element:
+              function:
+                function_name:
+                  function_name_identifier: CAST
+                bracketed:
+                  start_bracket: (
+                  expression:
+                    function:
+                      function_name:
+                        identifier: '[dbo]'
+                        dot: .
+                        function_name_identifier: '[CONVERT_ISO_WEEK_TO_DATETIME]'
+                      bracketed:
+                      - start_bracket: (
+                      - expression:
+                          function:
+                            function_name:
+                              function_name_identifier: LEFT
+                            bracketed:
+                            - start_bracket: (
+                            - expression:
+                                column_reference:
+                                  identifier: YEAR_WEEK
+                            - comma: ','
+                            - expression:
+                                literal: '4'
+                            - end_bracket: )
+                      - comma: ','
+                      - expression:
+                          function:
+                            function_name:
+                              function_name_identifier: RIGHT
+                            bracketed:
+                            - start_bracket: (
+                            - expression:
+                                column_reference:
+                                  identifier: YEAR_WEEK
+                            - comma: ','
+                            - expression:
+                                literal: '2'
+                            - end_bracket: )
+                      - end_bracket: )
+                  keyword: AS
+                  data_type:
+                    identifier: DATE
+                  end_bracket: )
+              alias_expression:
+                keyword: AS
+                identifier: '[WEEK_START]'
+          - comma: ','
+          - select_clause_element:
+              function:
+                function_name:
+                  function_name_identifier: CAST
+                bracketed:
+                  start_bracket: (
+                  expression:
+                    function:
+                      function_name:
+                        identifier: '[dbo]'
+                        dot: .
+                        function_name_identifier: '[WEEK_END]'
+                      bracketed:
+                        start_bracket: (
+                        expression:
+                          function:
+                            function_name:
+                              identifier: '[dbo]'
+                              dot: .
+                              function_name_identifier: '[CONVERT_ISO_WEEK_TO_DATETIME]'
+                            bracketed:
+                            - start_bracket: (
+                            - expression:
+                                function:
+                                  function_name:
+                                    function_name_identifier: LEFT
+                                  bracketed:
+                                  - start_bracket: (
+                                  - expression:
+                                      column_reference:
+                                        identifier: YEAR_WEEK
+                                  - comma: ','
+                                  - expression:
+                                      literal: '4'
+                                  - end_bracket: )
+                            - comma: ','
+                            - expression:
+                                function:
+                                  function_name:
+                                    function_name_identifier: RIGHT
+                                  bracketed:
+                                  - start_bracket: (
+                                  - expression:
+                                      column_reference:
+                                        identifier: YEAR_WEEK
+                                  - comma: ','
+                                  - expression:
+                                      literal: '2'
+                                  - end_bracket: )
+                            - end_bracket: )
+                        end_bracket: )
+                  keyword: AS
+                  data_type:
+                    identifier: DATE
+                  end_bracket: )
+              alias_expression:
+                keyword: AS
+                identifier: '[WEEK_END]'
+          - comma: ','
+          - select_clause_element:
+              function:
+                function_name:
+                  function_name_identifier: CAST
+                bracketed:
+                  start_bracket: (
+                  expression:
+                    column_reference:
+                      identifier: '[RATE_14_DAY]'
+                  keyword: AS
+                  data_type:
+                    identifier: FLOAT
+                  end_bracket: )
+              alias_expression:
+                keyword: AS
+                identifier: '[RATE_14_DAY]'
+          - comma: ','
+          - select_clause_element:
+              function:
+                function_name:
+                  function_name_identifier: CAST
+                bracketed:
+                  start_bracket: (
+                  expression:
+                    column_reference:
+                      identifier: '[CUMULATIVE_COUNT]'
+                  keyword: AS
+                  data_type:
+                    identifier: BIGINT
+                  end_bracket: )
+              alias_expression:
+                keyword: AS
+                identifier: '[CUMULATIVE_COUNT]'
+          - comma: ','
+          - select_clause_element:
+              column_reference:
+                identifier: '[SOURCE]'
+          from_clause:
+            keyword: FROM
+            from_expression:
+              from_expression_element:
+                table_expression:
+                  table_reference:
+                  - identifier: STAGE
+                  - dot: .
+                  - identifier: ECDC_CASES
diff --git a/test/fixtures/parser/tsql/minimal_function.yml b/test/fixtures/parser/tsql/minimal_function.yml
index 4ce17d87000..a2dcd133549 100644
--- a/test/fixtures/parser/tsql/minimal_function.yml
+++ b/test/fixtures/parser/tsql/minimal_function.yml
@@ -3,37 +3,38 @@
 # computed by SQLFluff when running the tests. Please run
 # `python test/generate_parse_fixture_yml.py`  to generate them after adding or
 # altering SQL files.
-_hash: 8796101a597443fdbc7e056390657d125081bfe093808514d3b4e4820fa2ef42
+_hash: a6d9e047340ab2e644dded7f192f27a80d93d065a353769feeab6dd1490109aa
 file:
-  statement:
-    create_function_statement:
-    - keyword: CREATE
-    - binary_operator: OR
-    - keyword: ALTER
-    - keyword: FUNCTION
-    - object_reference:
-      - identifier: '[dbo]'
-      - dot: .
-      - identifier: '[add]'
-    - base:
-        bracketed:
-        - start_bracket: (
-        - parameter: '@add_1'
-        - data_type:
-            identifier: int
-        - comma: ','
-        - parameter: '@add_2'
-        - data_type:
-            identifier: int
-        - end_bracket: )
-    - keyword: RETURNS
-    - data_type:
-        identifier: integer
-    - function_statement:
-      - keyword: AS
-      - raw: BEGIN
-      - raw: RETURN
-      - raw: '@add_1'
-      - raw: +
-      - raw: '@add_2'
-      - raw: END
+  batch:
+    statement:
+      create_function_statement:
+      - keyword: CREATE
+      - binary_operator: OR
+      - keyword: ALTER
+      - keyword: FUNCTION
+      - object_reference:
+        - identifier: '[dbo]'
+        - dot: .
+        - identifier: '[add]'
+      - base:
+          bracketed:
+          - start_bracket: (
+          - parameter: '@add_1'
+          - data_type:
+              identifier: int
+          - comma: ','
+          - parameter: '@add_2'
+          - data_type:
+              identifier: int
+          - end_bracket: )
+      - keyword: RETURNS
+      - data_type:
+          identifier: integer
+      - function_statement:
+        - keyword: AS
+        - raw: BEGIN
+        - raw: RETURN
+        - raw: '@add_1'
+        - raw: +
+        - raw: '@add_2'
+        - raw: END
diff --git a/test/fixtures/parser/tsql/minimal_function_no_alter.yml b/test/fixtures/parser/tsql/minimal_function_no_alter.yml
index eb79b007b71..c67e8210648 100644
--- a/test/fixtures/parser/tsql/minimal_function_no_alter.yml
+++ b/test/fixtures/parser/tsql/minimal_function_no_alter.yml
@@ -3,35 +3,36 @@
 # computed by SQLFluff when running the tests. Please run
 # `python test/generate_parse_fixture_yml.py`  to generate them after adding or
 # altering SQL files.
-_hash: 1b9f505b6b997a86fb0ac7923fb49eff037ffa49362772f5ea22ba2b40548260
+_hash: ff863a835ba5efbff0266c1b8a527be822108ca0a17ce06f2d00d932191a1e44
 file:
-  statement:
-    create_function_statement:
-    - keyword: CREATE
-    - keyword: FUNCTION
-    - object_reference:
-      - identifier: '[dbo]'
-      - dot: .
-      - identifier: '[add]'
-    - base:
-        bracketed:
-        - start_bracket: (
-        - parameter: '@add_1'
-        - data_type:
-            identifier: int
-        - comma: ','
-        - parameter: '@add_2'
-        - data_type:
-            identifier: int
-        - end_bracket: )
-    - keyword: RETURNS
-    - data_type:
-        identifier: integer
-    - function_statement:
-      - keyword: AS
-      - raw: BEGIN
-      - raw: RETURN
-      - raw: '@add_1'
-      - raw: +
-      - raw: '@add_2'
-      - raw: END
+  batch:
+    statement:
+      create_function_statement:
+      - keyword: CREATE
+      - keyword: FUNCTION
+      - object_reference:
+        - identifier: '[dbo]'
+        - dot: .
+        - identifier: '[add]'
+      - base:
+          bracketed:
+          - start_bracket: (
+          - parameter: '@add_1'
+          - data_type:
+              identifier: int
+          - comma: ','
+          - parameter: '@add_2'
+          - data_type:
+              identifier: int
+          - end_bracket: )
+      - keyword: RETURNS
+      - data_type:
+          identifier: integer
+      - function_statement:
+        - keyword: AS
+        - raw: BEGIN
+        - raw: RETURN
+        - raw: '@add_1'
+        - raw: +
+        - raw: '@add_2'
+        - raw: END
diff --git a/test/fixtures/parser/tsql/multi_statement_without_semicolon.yml b/test/fixtures/parser/tsql/multi_statement_without_semicolon.yml
index aac2095c80b..3518e2cf57f 100644
--- a/test/fixtures/parser/tsql/multi_statement_without_semicolon.yml
+++ b/test/fixtures/parser/tsql/multi_statement_without_semicolon.yml
@@ -3,37 +3,39 @@
 # computed by SQLFluff when running the tests. Please run
 # `python test/generate_parse_fixture_yml.py`  to generate them after adding or
 # altering SQL files.
-_hash: 502f22560130938bff6c35560e869e8254de36e5c71c0aa476e74e459c1c81b5
+_hash: 49e91577f0c1312dabaedbbd581f47db7f25f53ba69ff8689ec7847a48ef1787
 file:
-- statement:
-    select_statement:
-      select_clause:
-        keyword: select
-        select_clause_element:
-          column_reference:
-            identifier: a
-      from_clause:
-        keyword: from
-        from_expression:
-          from_expression_element:
-            table_expression:
-              table_reference:
-                identifier: tbl1
+- batch:
+    statement:
+      select_statement:
+        select_clause:
+          keyword: select
+          select_clause_element:
+            column_reference:
+              identifier: a
+        from_clause:
+          keyword: from
+          from_expression:
+            from_expression_element:
+              table_expression:
+                table_reference:
+                  identifier: tbl1
 - go_statement:
     keyword: GO
-- statement:
-    select_statement:
-      select_clause:
-        keyword: select
-        select_clause_element:
-          column_reference:
-            identifier: b
-      from_clause:
-        keyword: from
-        from_expression:
-          from_expression_element:
-            table_expression:
-              table_reference:
-                identifier: tbl2
+- batch:
+    statement:
+      select_statement:
+        select_clause:
+          keyword: select
+          select_clause_element:
+            column_reference:
+              identifier: b
+        from_clause:
+          keyword: from
+          from_expression:
+            from_expression_element:
+              table_expression:
+                table_reference:
+                  identifier: tbl2
 - go_statement:
     keyword: GO
diff --git a/test/fixtures/parser/tsql/select_cross_apply.yml b/test/fixtures/parser/tsql/select_cross_apply.yml
index 88357a57f05..a8e16e1853c 100644
--- a/test/fixtures/parser/tsql/select_cross_apply.yml
+++ b/test/fixtures/parser/tsql/select_cross_apply.yml
@@ -3,157 +3,158 @@
 # computed by SQLFluff when running the tests. Please run
 # `python test/generate_parse_fixture_yml.py`  to generate them after adding or
 # altering SQL files.
-_hash: c1465e29ed9fd6c3adac7d74cbb775cb91eeccf9c59e82ffad4447092add2e08
+_hash: 73aa8578d5053d367ebde5ddaca73333a6ef80897367a32be4828fea911396ed
 file:
-- statement:
-    select_statement:
-      select_clause:
-      - keyword: SELECT
-      - select_clause_element:
-          column_reference:
-            identifier: DeptID
-      - comma: ','
-      - select_clause_element:
-          column_reference:
-            identifier: DeptName
-      - comma: ','
-      - select_clause_element:
-          column_reference:
-            identifier: DeptMgrID
-      - comma: ','
-      - select_clause_element:
-          column_reference:
-            identifier: EmpID
-      - comma: ','
-      - select_clause_element:
-          column_reference:
-            identifier: EmpLastName
-      - comma: ','
-      - select_clause_element:
-          column_reference:
-            identifier: EmpSalary
-      from_clause:
-        keyword: FROM
-        from_expression:
-          from_expression_element:
-            table_expression:
-              table_reference:
-                identifier: Departments
-            alias_expression:
-              identifier: d
-          join_clause:
-          - keyword: CROSS
-          - keyword: APPLY
-          - from_expression_element:
+  batch:
+  - statement:
+      select_statement:
+        select_clause:
+        - keyword: SELECT
+        - select_clause_element:
+            column_reference:
+              identifier: DeptID
+        - comma: ','
+        - select_clause_element:
+            column_reference:
+              identifier: DeptName
+        - comma: ','
+        - select_clause_element:
+            column_reference:
+              identifier: DeptMgrID
+        - comma: ','
+        - select_clause_element:
+            column_reference:
+              identifier: EmpID
+        - comma: ','
+        - select_clause_element:
+            column_reference:
+              identifier: EmpLastName
+        - comma: ','
+        - select_clause_element:
+            column_reference:
+              identifier: EmpSalary
+        from_clause:
+          keyword: FROM
+          from_expression:
+            from_expression_element:
               table_expression:
-                function:
-                  function_name:
-                    identifier: dbo
-                    dot: .
-                    function_name_identifier: GetReports
-                  bracketed:
-                    start_bracket: (
-                    expression:
-                      column_reference:
-                      - identifier: d
-                      - dot: .
-                      - identifier: DeptMgrID
-                    end_bracket: )
-- statement_terminator: ;
-- statement:
-    select_statement:
-      select_clause:
-        keyword: SELECT
-        select_clause_element:
-          wildcard_expression:
-            wildcard_identifier:
-              star: '*'
-      from_clause:
-        keyword: FROM
-        from_expression:
-          from_expression_element:
-            table_expression:
-              table_reference:
-                identifier: Department
-            alias_expression:
-              identifier: D
-          join_clause:
-          - keyword: OUTER
-          - keyword: APPLY
-          - from_expression_element:
+                table_reference:
+                  identifier: Departments
+              alias_expression:
+                identifier: d
+            join_clause:
+            - keyword: CROSS
+            - keyword: APPLY
+            - from_expression_element:
+                table_expression:
+                  function:
+                    function_name:
+                      identifier: dbo
+                      dot: .
+                      function_name_identifier: GetReports
+                    bracketed:
+                      start_bracket: (
+                      expression:
+                        column_reference:
+                        - identifier: d
+                        - dot: .
+                        - identifier: DeptMgrID
+                      end_bracket: )
+  - statement_terminator: ;
+  - statement:
+      select_statement:
+        select_clause:
+          keyword: SELECT
+          select_clause_element:
+            wildcard_expression:
+              wildcard_identifier:
+                star: '*'
+        from_clause:
+          keyword: FROM
+          from_expression:
+            from_expression_element:
               table_expression:
-                function:
-                  function_name:
-                    identifier: dbo
-                    dot: .
-                    function_name_identifier: fn_GetAllEmployeeOfADepartment
-                  bracketed:
-                    start_bracket: (
-                    expression:
-                      column_reference:
-                      - identifier: D
-                      - dot: .
-                      - identifier: DepartmentID
-                    end_bracket: )
-- statement_terminator: ;
-- statement:
-    select_statement:
-      select_clause:
-      - keyword: select
-      - select_clause_element:
-          column_reference:
-          - identifier: s
-          - dot: .
-          - identifier: column_id
-      - comma: ','
-      - select_clause_element:
-          column_reference:
-          - identifier: sp
-          - dot: .
-          - identifier: value
-      from_clause:
-        keyword: from
-        from_expression:
-          from_expression_element:
-            table_expression:
-              table_reference:
-                identifier: table1
-            alias_expression:
-              keyword: as
-              identifier: s
-          join_clause:
-          - keyword: cross
-          - keyword: apply
-          - from_expression_element:
+                table_reference:
+                  identifier: Department
+              alias_expression:
+                identifier: D
+            join_clause:
+            - keyword: OUTER
+            - keyword: APPLY
+            - from_expression_element:
+                table_expression:
+                  function:
+                    function_name:
+                      identifier: dbo
+                      dot: .
+                      function_name_identifier: fn_GetAllEmployeeOfADepartment
+                    bracketed:
+                      start_bracket: (
+                      expression:
+                        column_reference:
+                        - identifier: D
+                        - dot: .
+                        - identifier: DepartmentID
+                      end_bracket: )
+  - statement_terminator: ;
+  - statement:
+      select_statement:
+        select_clause:
+        - keyword: select
+        - select_clause_element:
+            column_reference:
+            - identifier: s
+            - dot: .
+            - identifier: column_id
+        - comma: ','
+        - select_clause_element:
+            column_reference:
+            - identifier: sp
+            - dot: .
+            - identifier: value
+        from_clause:
+          keyword: from
+          from_expression:
+            from_expression_element:
               table_expression:
-                function:
-                  function_name:
-                    function_name_identifier: string_split
-                  bracketed:
-                  - start_bracket: (
-                  - expression:
-                      function:
-                        function_name:
-                          function_name_identifier: replace
-                        bracketed:
-                        - start_bracket: (
-                        - expression:
-                            column_reference:
-                            - identifier: s
-                            - dot: .
-                            - identifier: some_path
-                        - comma: ','
-                        - expression:
-                            literal: "'->'"
-                        - comma: ','
-                        - expression:
-                            literal: "'{'"
-                        - end_bracket: )
-                  - comma: ','
-                  - expression:
-                      literal: "'{'"
-                  - end_bracket: )
+                table_reference:
+                  identifier: table1
               alias_expression:
                 keyword: as
-                identifier: sp
-- statement_terminator: ;
+                identifier: s
+            join_clause:
+            - keyword: cross
+            - keyword: apply
+            - from_expression_element:
+                table_expression:
+                  function:
+                    function_name:
+                      function_name_identifier: string_split
+                    bracketed:
+                    - start_bracket: (
+                    - expression:
+                        function:
+                          function_name:
+                            function_name_identifier: replace
+                          bracketed:
+                          - start_bracket: (
+                          - expression:
+                              column_reference:
+                              - identifier: s
+                              - dot: .
+                              - identifier: some_path
+                          - comma: ','
+                          - expression:
+                              literal: "'->'"
+                          - comma: ','
+                          - expression:
+                              literal: "'{'"
+                          - end_bracket: )
+                    - comma: ','
+                    - expression:
+                        literal: "'{'"
+                    - end_bracket: )
+                alias_expression:
+                  keyword: as
+                  identifier: sp
+  - statement_terminator: ;
diff --git a/test/fixtures/parser/tsql/select_top.yml b/test/fixtures/parser/tsql/select_top.yml
index 465e6b8eefb..44ba71278a6 100644
--- a/test/fixtures/parser/tsql/select_top.yml
+++ b/test/fixtures/parser/tsql/select_top.yml
@@ -3,250 +3,251 @@
 # computed by SQLFluff when running the tests. Please run
 # `python test/generate_parse_fixture_yml.py`  to generate them after adding or
 # altering SQL files.
-_hash: 638b17dd30fb11a2cb006c0ef9e7550cca51aedfbf7d52de4807a56b8f241875
+_hash: 2fb2c3524a0d1e3aa0bb02f597f70213a2875c216b42f9460360c6b3892ec84f
 file:
-- statement:
-    select_statement:
-      select_clause:
-        keyword: select
-        select_clause_modifier:
-          keyword: top
-          expression:
-            literal: '1'
-        select_clause_element:
-          column_reference:
-          - identifier: t
-          - dot: .
-          - identifier: date_column1
-          alias_expression:
-            keyword: as
-            identifier: last_date_column1
-      from_clause:
-        keyword: from
-        from_expression:
-          from_expression_element:
-            table_expression:
-              table_reference:
-              - identifier: t1
-              - dot: .
-              - identifier: t2
-              - dot: .
-              - identifier: table_name
-            alias_expression:
-              identifier: t
-      orderby_clause:
-      - keyword: order
-      - keyword: by
-      - column_reference:
-        - identifier: t
-        - dot: .
-        - identifier: column1
-      - keyword: desc
-- statement_terminator: ;
-- statement:
-    select_statement:
-      select_clause:
-      - keyword: SELECT
-      - select_clause_modifier:
-          keyword: TOP
-          bracketed:
-            start_bracket: (
+  batch:
+  - statement:
+      select_statement:
+        select_clause:
+          keyword: select
+          select_clause_modifier:
+            keyword: top
             expression:
-              literal: '10'
-            end_bracket: )
-      - select_clause_element:
-          column_reference:
-            identifier: JobTitle
-      - comma: ','
-      - select_clause_element:
-          column_reference:
-            identifier: HireDate
-      from_clause:
-        keyword: FROM
-        from_expression:
-          from_expression_element:
-            table_expression:
-              table_reference:
-              - identifier: HumanResources
-              - dot: .
-              - identifier: Employee
-- statement_terminator: ;
-- statement:
-    select_statement:
-      select_clause:
-      - keyword: SELECT
-      - select_clause_modifier:
-          keyword: TOP
-          bracketed:
-            start_bracket: (
-            expression:
-              literal: '10'
-            end_bracket: )
-      - select_clause_element:
-          column_reference:
-            identifier: JobTitle
-      - comma: ','
-      - select_clause_element:
-          column_reference:
-            identifier: HireDate
-      from_clause:
-        keyword: FROM
-        from_expression:
-          from_expression_element:
-            table_expression:
-              table_reference:
-              - identifier: HumanResources
-              - dot: .
-              - identifier: Employee
-      orderby_clause:
-      - keyword: ORDER
-      - keyword: BY
-      - column_reference:
-          identifier: HireDate
-      - keyword: DESC
-- statement_terminator: ;
-- statement:
-    select_statement:
-      select_clause:
-      - keyword: SELECT
-      - select_clause_modifier:
-        - keyword: TOP
-        - bracketed:
-            start_bracket: (
-            expression:
-              literal: '5'
-            end_bracket: )
-        - keyword: PERCENT
-      - select_clause_element:
-          column_reference:
-            identifier: JobTitle
-      - comma: ','
-      - select_clause_element:
-          column_reference:
-            identifier: HireDate
-      from_clause:
-        keyword: FROM
-        from_expression:
-          from_expression_element:
-            table_expression:
-              table_reference:
-              - identifier: HumanResources
-              - dot: .
-              - identifier: Employee
-      orderby_clause:
-      - keyword: ORDER
-      - keyword: BY
-      - column_reference:
-          identifier: HireDate
-      - keyword: DESC
-- statement_terminator: ;
-- statement:
-    select_statement:
-      select_clause:
-      - keyword: SELECT
-      - select_clause_modifier:
-        - keyword: TOP
-        - bracketed:
-            start_bracket: (
-            expression:
-              literal: '10'
-            end_bracket: )
-        - keyword: PERCENT
-        - keyword: WITH
-        - keyword: TIES
-      - select_clause_element:
-          column_reference:
-          - identifier: pp
-          - dot: .
-          - identifier: FirstName
-      - comma: ','
-      - select_clause_element:
-          column_reference:
-          - identifier: pp
-          - dot: .
-          - identifier: LastName
-      - comma: ','
-      - select_clause_element:
-          column_reference:
-          - identifier: e
-          - dot: .
-          - identifier: JobTitle
-      - comma: ','
-      - select_clause_element:
-          column_reference:
-          - identifier: e
-          - dot: .
-          - identifier: Gender
-      - comma: ','
-      - select_clause_element:
-          column_reference:
-          - identifier: r
-          - dot: .
-          - identifier: Rate
-      from_clause:
-        keyword: FROM
-        from_expression:
-        - from_expression_element:
-            table_expression:
-              table_reference:
-              - identifier: Person
-              - dot: .
-              - identifier: Person
+              literal: '1'
+          select_clause_element:
+            column_reference:
+            - identifier: t
+            - dot: .
+            - identifier: date_column1
             alias_expression:
-              keyword: AS
-              identifier: pp
-        - join_clause:
-          - keyword: INNER
-          - keyword: JOIN
-          - from_expression_element:
+              keyword: as
+              identifier: last_date_column1
+        from_clause:
+          keyword: from
+          from_expression:
+            from_expression_element:
+              table_expression:
+                table_reference:
+                - identifier: t1
+                - dot: .
+                - identifier: t2
+                - dot: .
+                - identifier: table_name
+              alias_expression:
+                identifier: t
+        orderby_clause:
+        - keyword: order
+        - keyword: by
+        - column_reference:
+          - identifier: t
+          - dot: .
+          - identifier: column1
+        - keyword: desc
+  - statement_terminator: ;
+  - statement:
+      select_statement:
+        select_clause:
+        - keyword: SELECT
+        - select_clause_modifier:
+            keyword: TOP
+            bracketed:
+              start_bracket: (
+              expression:
+                literal: '10'
+              end_bracket: )
+        - select_clause_element:
+            column_reference:
+              identifier: JobTitle
+        - comma: ','
+        - select_clause_element:
+            column_reference:
+              identifier: HireDate
+        from_clause:
+          keyword: FROM
+          from_expression:
+            from_expression_element:
               table_expression:
                 table_reference:
                 - identifier: HumanResources
                 - dot: .
                 - identifier: Employee
-              alias_expression:
-                keyword: AS
-                identifier: e
-          - join_on_condition:
-              keyword: 'ON'
+  - statement_terminator: ;
+  - statement:
+      select_statement:
+        select_clause:
+        - keyword: SELECT
+        - select_clause_modifier:
+            keyword: TOP
+            bracketed:
+              start_bracket: (
               expression:
-              - column_reference:
-                - identifier: pp
+                literal: '10'
+              end_bracket: )
+        - select_clause_element:
+            column_reference:
+              identifier: JobTitle
+        - comma: ','
+        - select_clause_element:
+            column_reference:
+              identifier: HireDate
+        from_clause:
+          keyword: FROM
+          from_expression:
+            from_expression_element:
+              table_expression:
+                table_reference:
+                - identifier: HumanResources
                 - dot: .
-                - identifier: BusinessEntityID
-              - comparison_operator: '='
-              - column_reference:
-                - identifier: e
+                - identifier: Employee
+        orderby_clause:
+        - keyword: ORDER
+        - keyword: BY
+        - column_reference:
+            identifier: HireDate
+        - keyword: DESC
+  - statement_terminator: ;
+  - statement:
+      select_statement:
+        select_clause:
+        - keyword: SELECT
+        - select_clause_modifier:
+          - keyword: TOP
+          - bracketed:
+              start_bracket: (
+              expression:
+                literal: '5'
+              end_bracket: )
+          - keyword: PERCENT
+        - select_clause_element:
+            column_reference:
+              identifier: JobTitle
+        - comma: ','
+        - select_clause_element:
+            column_reference:
+              identifier: HireDate
+        from_clause:
+          keyword: FROM
+          from_expression:
+            from_expression_element:
+              table_expression:
+                table_reference:
+                - identifier: HumanResources
                 - dot: .
-                - identifier: BusinessEntityID
-        - join_clause:
-          - keyword: INNER
-          - keyword: JOIN
+                - identifier: Employee
+        orderby_clause:
+        - keyword: ORDER
+        - keyword: BY
+        - column_reference:
+            identifier: HireDate
+        - keyword: DESC
+  - statement_terminator: ;
+  - statement:
+      select_statement:
+        select_clause:
+        - keyword: SELECT
+        - select_clause_modifier:
+          - keyword: TOP
+          - bracketed:
+              start_bracket: (
+              expression:
+                literal: '10'
+              end_bracket: )
+          - keyword: PERCENT
+          - keyword: WITH
+          - keyword: TIES
+        - select_clause_element:
+            column_reference:
+            - identifier: pp
+            - dot: .
+            - identifier: FirstName
+        - comma: ','
+        - select_clause_element:
+            column_reference:
+            - identifier: pp
+            - dot: .
+            - identifier: LastName
+        - comma: ','
+        - select_clause_element:
+            column_reference:
+            - identifier: e
+            - dot: .
+            - identifier: JobTitle
+        - comma: ','
+        - select_clause_element:
+            column_reference:
+            - identifier: e
+            - dot: .
+            - identifier: Gender
+        - comma: ','
+        - select_clause_element:
+            column_reference:
+            - identifier: r
+            - dot: .
+            - identifier: Rate
+        from_clause:
+          keyword: FROM
+          from_expression:
           - from_expression_element:
               table_expression:
                 table_reference:
-                - identifier: HumanResources
+                - identifier: Person
                 - dot: .
-                - identifier: EmployeePayHistory
+                - identifier: Person
               alias_expression:
                 keyword: AS
-                identifier: r
-          - join_on_condition:
-              keyword: 'ON'
-              expression:
-              - column_reference:
-                - identifier: r
-                - dot: .
-                - identifier: BusinessEntityID
-              - comparison_operator: '='
-              - column_reference:
-                - identifier: e
-                - dot: .
-                - identifier: BusinessEntityID
-      orderby_clause:
-      - keyword: ORDER
-      - keyword: BY
-      - column_reference:
-          identifier: Rate
-      - keyword: DESC
-- statement_terminator: ;
+                identifier: pp
+          - join_clause:
+            - keyword: INNER
+            - keyword: JOIN
+            - from_expression_element:
+                table_expression:
+                  table_reference:
+                  - identifier: HumanResources
+                  - dot: .
+                  - identifier: Employee
+                alias_expression:
+                  keyword: AS
+                  identifier: e
+            - join_on_condition:
+                keyword: 'ON'
+                expression:
+                - column_reference:
+                  - identifier: pp
+                  - dot: .
+                  - identifier: BusinessEntityID
+                - comparison_operator: '='
+                - column_reference:
+                  - identifier: e
+                  - dot: .
+                  - identifier: BusinessEntityID
+          - join_clause:
+            - keyword: INNER
+            - keyword: JOIN
+            - from_expression_element:
+                table_expression:
+                  table_reference:
+                  - identifier: HumanResources
+                  - dot: .
+                  - identifier: EmployeePayHistory
+                alias_expression:
+                  keyword: AS
+                  identifier: r
+            - join_on_condition:
+                keyword: 'ON'
+                expression:
+                - column_reference:
+                  - identifier: r
+                  - dot: .
+                  - identifier: BusinessEntityID
+                - comparison_operator: '='
+                - column_reference:
+                  - identifier: e
+                  - dot: .
+                  - identifier: BusinessEntityID
+        orderby_clause:
+        - keyword: ORDER
+        - keyword: BY
+        - column_reference:
+            identifier: Rate
+        - keyword: DESC
+  - statement_terminator: ;
diff --git a/test/fixtures/parser/tsql/sequence.yml b/test/fixtures/parser/tsql/sequence.yml
index 678c0326cb4..432b9ce3f31 100644
--- a/test/fixtures/parser/tsql/sequence.yml
+++ b/test/fixtures/parser/tsql/sequence.yml
@@ -3,19 +3,20 @@
 # computed by SQLFluff when running the tests. Please run
 # `python test/generate_parse_fixture_yml.py`  to generate them after adding or
 # altering SQL files.
-_hash: d542fc03a57fbb094b7e14baff05909a16980d246896fc017956ca240ef092d3
+_hash: 4bf4f4edeaac5286379526a4187cc60a9c048430ef38e4a4cb3fb3a9fe35f513
 file:
-  statement:
-    create_sequence_statement:
-    - keyword: CREATE
-    - keyword: SEQUENCE
-    - sequence_reference:
-        identifier: SEQ_MELDER
-    - create_sequence_options_segment:
-      - keyword: START
-      - keyword: WITH
-      - literal: '1'
-    - create_sequence_options_segment:
-      - keyword: INCREMENT
-      - keyword: BY
-      - literal: '1'
+  batch:
+    statement:
+      create_sequence_statement:
+      - keyword: CREATE
+      - keyword: SEQUENCE
+      - sequence_reference:
+          identifier: SEQ_MELDER
+      - create_sequence_options_segment:
+        - keyword: START
+        - keyword: WITH
+        - literal: '1'
+      - create_sequence_options_segment:
+        - keyword: INCREMENT
+        - keyword: BY
+        - literal: '1'
diff --git a/test/fixtures/parser/tsql/stored_procedure_begin_end.sql b/test/fixtures/parser/tsql/stored_procedure_begin_end.sql
new file mode 100644
index 00000000000..edaa2f69d5b
--- /dev/null
+++ b/test/fixtures/parser/tsql/stored_procedure_begin_end.sql
@@ -0,0 +1,9 @@
+CREATE PROCEDURE dbo.Test_Begin_End
+AS
+BEGIN
+	SELECT 'Weekend';
+	
+	select a from tbl1;
+	
+	select b from tbl2;
+END
diff --git a/test/fixtures/parser/tsql/stored_procedure_begin_end.yml b/test/fixtures/parser/tsql/stored_procedure_begin_end.yml
new file mode 100644
index 00000000000..ab15ad4e871
--- /dev/null
+++ b/test/fixtures/parser/tsql/stored_procedure_begin_end.yml
@@ -0,0 +1,58 @@
+# YML test files are auto-generated from SQL files and should not be edited by
+# hand. To help enforce this, the "hash" field in the file must match a hash
+# computed by SQLFluff when running the tests. Please run
+# `python test/generate_parse_fixture_yml.py`  to generate them after adding or
+# altering SQL files.
+_hash: 07931a42221549599e8dc934a850c844e413378012ad5c9e33aae02458d9d97a
+file:
+  batch:
+    create_procedure_statement:
+    - keyword: CREATE
+    - keyword: PROCEDURE
+    - object_reference:
+      - identifier: dbo
+      - dot: .
+      - identifier: Test_Begin_End
+    - keyword: AS
+    - procedure_statement:
+        begin_end_block:
+        - keyword: BEGIN
+        - batch:
+          - statement:
+              select_statement:
+                select_clause:
+                  keyword: SELECT
+                  select_clause_element:
+                    literal: "'Weekend'"
+          - statement_terminator: ;
+          - statement:
+              select_statement:
+                select_clause:
+                  keyword: select
+                  select_clause_element:
+                    column_reference:
+                      identifier: a
+                from_clause:
+                  keyword: from
+                  from_expression:
+                    from_expression_element:
+                      table_expression:
+                        table_reference:
+                          identifier: tbl1
+          - statement_terminator: ;
+          - statement:
+              select_statement:
+                select_clause:
+                  keyword: select
+                  select_clause_element:
+                    column_reference:
+                      identifier: b
+                from_clause:
+                  keyword: from
+                  from_expression:
+                    from_expression_element:
+                      table_expression:
+                        table_reference:
+                          identifier: tbl2
+          - statement_terminator: ;
+        - keyword: END
diff --git a/test/fixtures/parser/tsql/stored_procedure_simple.yml b/test/fixtures/parser/tsql/stored_procedure_simple.yml
index 5aa6479ef18..11f3eebebe5 100644
--- a/test/fixtures/parser/tsql/stored_procedure_simple.yml
+++ b/test/fixtures/parser/tsql/stored_procedure_simple.yml
@@ -3,9 +3,9 @@
 # computed by SQLFluff when running the tests. Please run
 # `python test/generate_parse_fixture_yml.py`  to generate them after adding or
 # altering SQL files.
-_hash: 7cd9182396a63ead72e3af742eeb05bac01bfa7f74af207d04c8ba2c7fac88e1
+_hash: 250b127099aafcc393f57e26d0ef2c27991ad81d8e9b6d1ac6801952b73a2697
 file:
-  statement:
+  batch:
     create_procedure_statement:
     - keyword: CREATE
     - keyword: PROC
diff --git a/test/fixtures/parser/tsql/stored_procedure_single_statement.yml b/test/fixtures/parser/tsql/stored_procedure_single_statement.yml
index cf0b9a4c4f1..c311908dbb2 100644
--- a/test/fixtures/parser/tsql/stored_procedure_single_statement.yml
+++ b/test/fixtures/parser/tsql/stored_procedure_single_statement.yml
@@ -3,9 +3,9 @@
 # computed by SQLFluff when running the tests. Please run
 # `python test/generate_parse_fixture_yml.py`  to generate them after adding or
 # altering SQL files.
-_hash: fb551b4278990456d8f7f5a6e7d89f6f966de292ce85bb156f84e8b35b608c7c
+_hash: 05c85512b6faf6acfd23b4189629c90c2471900a538fb57fb36d7856fab5329a
 file:
-  statement:
+  batch:
     create_procedure_statement:
     - keyword: CREATE
     - binary_operator: OR
diff --git a/test/fixtures/parser/tsql/transaction.sql b/test/fixtures/parser/tsql/transaction.sql
new file mode 100644
index 00000000000..7f41c13763c
--- /dev/null
+++ b/test/fixtures/parser/tsql/transaction.sql
@@ -0,0 +1,4 @@
+BEGIN TRANSACTION;  
+DELETE FROM HumanResources.JobCandidate  
+    WHERE JobCandidateID = 13;  
+COMMIT;  
diff --git a/test/fixtures/parser/tsql/transaction.yml b/test/fixtures/parser/tsql/transaction.yml
new file mode 100644
index 00000000000..283801b5aa4
--- /dev/null
+++ b/test/fixtures/parser/tsql/transaction.yml
@@ -0,0 +1,37 @@
+# YML test files are auto-generated from SQL files and should not be edited by
+# hand. To help enforce this, the "hash" field in the file must match a hash
+# computed by SQLFluff when running the tests. Please run
+# `python test/generate_parse_fixture_yml.py`  to generate them after adding or
+# altering SQL files.
+_hash: 71ac6e34a041b0049eb86cdd0a2c765dd23e322db40a024789dd6e049b2067dd
+file:
+  batch:
+  - statement:
+      transaction_statement:
+      - keyword: BEGIN
+      - keyword: TRANSACTION
+  - statement_terminator: ;
+  - statement:
+      delete_statement:
+        keyword: DELETE
+        from_clause:
+          keyword: FROM
+          from_expression:
+            from_expression_element:
+              table_expression:
+                table_reference:
+                - identifier: HumanResources
+                - dot: .
+                - identifier: JobCandidate
+        where_clause:
+          keyword: WHERE
+          expression:
+            column_reference:
+              identifier: JobCandidateID
+            comparison_operator: '='
+            literal: '13'
+  - statement_terminator: ;
+  - statement:
+      transaction_statement:
+        keyword: COMMIT
+  - statement_terminator: ;


Code review comments:
diff_hunk: @@ -65,11 +67,7 @@
 tsql_dialect.replace(
     # Below delimiterstatement might need to be removed in the future as delimiting
     # is optional with semicolon and GO is a end of statement indicator.
path: src/sqlfluff/dialects/dialect_tsql.py
text: @user1:
Can we remove these lines now you've done the work?

diff_hunk: @@ -981,3 +982,82 @@ class DatePartClause(BaseSegment):
         "YY",
         "YYYY",
     )
+
+
+@tsql_dialect.segment(replace=True)
+class TransactionStatementSegment(BaseSegment):
+    """A `COMMIT`, `ROLLBACK` or `TRANSACTION` statement."""
+
+    type = "transaction_statement"
+    match_grammar = OneOf(
+        # BEGIN | SAVE TRANSACTION
+        # COMMIT [ TRANSACTION | WORK ]
+        # ROLLBACK [ TRANSACTION | WORK ]
+        # https://docs.microsoft.com/en-us/sql/t-sql/language-elements/begin-transaction-transact-sql?view=sql-server-ver15
+        Sequence(
+            "BEGIN",
+            Sequence("DISTRIBUTED", optional=True),
+            "TRANSACTION",
+            Ref("SingleIdentifierGrammar", optional=True),
+            Sequence("WITH", "MARK", Ref("QuotedIdentifierSegment"), optional=True),
+        ),
+        Sequence(
+            OneOf("COMMIT", "ROLLBACK"), OneOf("TRANSACTION", "WORK", optional=True)
+        ),
+        Sequence("SAVE", "TRANSACTION"),
+    )
+
+
+@tsql_dialect.segment(replace=True)
+class FileSegment(BaseFileSegment):
+    """A segment representing a whole file or script.
+
+    This is also the default "root" segment of the dialect,
+    and so is usually instantiated directly. It therefore
+    has no match_grammar.
+    """
+
+    # NB: We don't need a match_grammar here because we're
+    # going straight into instantiating it directly usually.
+    parse_grammar = Delimited(
+        Ref("BatchSegment"),
path: src/sqlfluff/dialects/dialect_tsql.py
text: @user1:
Would this `FileSegment ` be better at the end of the file - after `BatchSegment` is defined? It works fine as is, but might be more readable.

diff_hunk: @@ -65,11 +67,7 @@
 tsql_dialect.replace(
     # Below delimiterstatement might need to be removed in the future as delimiting
     # is optional with semicolon and GO is a end of statement indicator.
-    DelimiterSegment=OneOf(
-        Sequence(Ref("SemicolonSegment"), Ref("GoStatementSegment")),
-        Ref("SemicolonSegment"),
-        Ref("GoStatementSegment"),
-    ),
+    DelimiterSegment=Ref("SemicolonSegment"),
path: src/sqlfluff/dialects/dialect_tsql.py
text: @user1:
Do we need this since we're now back to the default?

diff_hunk: @@ -981,3 +982,82 @@ class DatePartClause(BaseSegment):
         "YY",
         "YYYY",
     )
+
+
+@tsql_dialect.segment(replace=True)
+class TransactionStatementSegment(BaseSegment):
+    """A `COMMIT`, `ROLLBACK` or `TRANSACTION` statement."""
+
+    type = "transaction_statement"
+    match_grammar = OneOf(
+        # BEGIN | SAVE TRANSACTION
+        # COMMIT [ TRANSACTION | WORK ]
+        # ROLLBACK [ TRANSACTION | WORK ]
+        # https://docs.microsoft.com/en-us/sql/t-sql/language-elements/begin-transaction-transact-sql?view=sql-server-ver15
+        Sequence(
+            "BEGIN",
+            Sequence("DISTRIBUTED", optional=True),
+            "TRANSACTION",
+            Ref("SingleIdentifierGrammar", optional=True),
+            Sequence("WITH", "MARK", Ref("QuotedIdentifierSegment"), optional=True),
+        ),
+        Sequence(
+            OneOf("COMMIT", "ROLLBACK"), OneOf("TRANSACTION", "WORK", optional=True)
+        ),
+        Sequence("SAVE", "TRANSACTION"),
+    )
+
+
+@tsql_dialect.segment(replace=True)
+class FileSegment(BaseFileSegment):
+    """A segment representing a whole file or script.
+
+    This is also the default "root" segment of the dialect,
+    and so is usually instantiated directly. It therefore
+    has no match_grammar.
+    """
path: src/sqlfluff/dialects/dialect_tsql.py
text: @user1:
When overriding I always like to add the reason for overriding:

```suggestion
    """A segment representing a whole file or script.

    We override default as T-SQL allows concept of several
    batches of commands separated by GO as well as usual
    Semi-colon statement separated lines.

    This is also the default "root" segment of the dialect,
    and so is usually instantiated directly. It therefore
    has no match_grammar.
    """
```