Executing SQL batch containing GO statements in C#

前端 未结 3 496
[愿得一人]
[愿得一人] 2020-12-30 15:37

I am trying to build a program which execute sql statements in batch with error handling (therefore I am not using SMO).

the problem is that GO is not a part

3条回答
  •  攒了一身酷
    2020-12-30 16:05

    Split only when "GO" stands on a lonely line or with whitespaces, like this:

    Regex.Split(statements, @"^\s+GO\s+$");
    

提交回复
热议问题