How do I accurately handle a batch seperator for SQL from C#

Posted by Sam Saffron on Stack Overflow See other posts from Stack Overflow or by Sam Saffron
Published on 2010-05-31T01:21:20Z Indexed on 2010/05/31 1:32 UTC
Read the original article Hit count: 279

Filed under:
|

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?

© Stack Overflow or respective owner

Related posts about c#

Related posts about sql