How do I accurately handle a batch separator 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/06/03 3:04 UTC
Read the original article Hit count: 275

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