For Data Explorer I would like to add support for a Batch separator.
So for example if users type in:
select 'GO' go select 1 as go Go select 100
I would like to return the three result sets.
Its clear that I need some sort of parser here, my hope is that this is a solved problem and I can just plug it in. (writing a full T-SQL parser is not something I would like to do)
What component / demo code could achieve splitting this batch into its 3 parts?
It’s not often that I say this, but this is a case where I’d definitely advocate bending the user input to conform to computer rules rather than trying to solve the problem of having a computer understand massively varied user input
Impose a simple rule of:
The word “go” must appear on its own line in order to be interpreted as a command to proceed
If your users can’t adhere to a rule like that, should they really be engaged in the far more complex task of writing SQL queries?