grammars-v4 icon indicating copy to clipboard operation
grammars-v4 copied to clipboard

T-SQL grammar does not parse SWITCH PARTITION n TO correctly

Open Ozzah opened this issue 3 years ago • 1 comments

Consider the T-SQL statement:

ALTER TABLE [dbo].[MyTable] SWITCH PARTITION 1 TO [dbo].[MyTable_Tombstone]

The current T-SQL Parser appears to break this statement into a parse tree with three top-level nodes: ALTER: ALTER TABLE: TABLE table_name: [dbo].[MyTable] SWITCH PARTITION 1 TO [dbo].[MyTable_Tombstone]

However it should be something more like: ALTER: ALTER TABLE: TABLE table_name: [dbo].[MyTable] switch_partition: SWITCH PARTITION DECIMAL: 1 TO: TO table_name: [dbo].[MyTable_Tombstone]

I don't think it's relevant in this case but I'm using Antlr4 4.6.6 from NuGet in .NET 6.

Ozzah avatar Mar 01 '22 05:03 Ozzah

Here is the relevant section on the Microsoft documentation.

Ozzah avatar Mar 01 '22 06:03 Ozzah