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

ADD and DROP SPARSE for T-SQL

Open Ozzah opened this issue 2 years ago • 5 comments

Add lexer definitions for implicit tokens for T-SQL: ANTLR4 is spitting a bunch of warnings about implicit tokens, e.g. PARSEONLY, SHOWPLAN_ALL, etc., so I explicitly defined these in the lexer file. I also noticed a parser node NOEXEol which I assume should be NOEXEC. I found no reference to the former in the Microsoft documentation.

Define IPV4_ADDR and IPV6_ADDR components in T-SQL lexer: IPV4_ADDR and IPV6_ADDR are now defined in terms of IPV4_OCTET and IPV6_QUARTET. There may be a more elegant way to achieve this - I did try using the regex {1-3} syntax, however the C# code generation was invalid.

Add ADD SPARSE and DROP SPARSE column modifiers to T-SQL parser Update T-SQL examples to show ADD SPARSE and DROP SPARSE See: https://docs.microsoft.com/en-us/sql/t-sql/statements/alter-table-transact-sql?view=sql-server-ver15

To convert the C4 non-sparse column to a sparse column, execute the following statement.

ALTER TABLE T1
ALTER COLUMN C4 ADD SPARSE ;
GO

To convert the C4 sparse column to a nonsparse column, execute the following statement.

ALTER TABLE T1
ALTER COLUMN C4 DROP SPARSE ;
GO

Ozzah avatar Mar 18 '22 01:03 Ozzah

What's going on with these failed CI tests? Same story with every other PR. Is there something broken in the pipeline?

Ozzah avatar Mar 18 '22 01:03 Ozzah

Sorry, never mind. There was in fact a bug in 1928265 commit

Ozzah avatar Mar 18 '22 03:03 Ozzah

I went ahead and added the remaining column modifiers from https://docs.microsoft.com/en-us/sql/t-sql/statements/alter-table-transact-sql?view=sql-server-ver15

      | { ADD | DROP } { ROWGUIDCOL | PERSISTED | NOT FOR REPLICATION | SPARSE | HIDDEN }
      | { ADD | DROP } MASKED [ WITH ( FUNCTION = ' mask_function ') ]

Ozzah avatar Mar 18 '22 03:03 Ozzah

@KvanTTT good to pull?

teverett avatar Mar 28 '22 02:03 teverett

Some issues should be fixed before merging.

KvanTTT avatar Mar 28 '22 18:03 KvanTTT

HIDDEN_

FYI, we already have 'HIDDEN' literal, it is called HIDDEN_KEYWORD.

pguyot avatar Aug 18 '22 12:08 pguyot

Could you please fix merge conflicts?

KvanTTT avatar Sep 11 '22 11:09 KvanTTT

Thank you for the contribution and welcome to ANTLR grammars repository!

KvanTTT avatar Sep 15 '22 13:09 KvanTTT