microsoft / SqlScriptDOM

ScriptDOM/SqlDOM is a .NET library for parsing T-SQL statements and interacting with its abstract syntax tree
MIT License
136 stars 18 forks source link

GO [count] not parsed #32

Open ghost opened 2 years ago

ghost commented 2 years ago

Steps to Reproduce:

  1. parse T-SQL script with GO [count] statement
  2. parsing fails on [count]

GO: https://docs.microsoft.com/en-us/sql/t-sql/language-elements/sql-server-utilities-statements-go?view=sql-server-ver15

sample parsing code: https://gist.github.com/josef-marec/1a56d2d04418fd749d0285aaaf440253

sample T-SQL:

` select current_timestamp

GO 2 `

Did this occur in prior versions? If not - which version(s) did it work in?

yes

dzsquared commented 2 years ago

This is expected behavior - as the page you linked mentions GO isn’t valid tsql, it’s specific to a few environments.

ghost commented 2 years ago

you mean, that i should expect this to be parsed:

select current_timestamp GO

while this not:

select current_timestamp GO 2

i know where GO is valid, i wonder why Microsoft.SqlServer.TransactSql.ScriptDom supports GO only without its conditional parameter