Wie führen Sie das Fragment oder SQLBatch mithilfe von Skriptdom aus?

using (TextReader reader = new StringReader(script))
{
    TSqlParser parser = new TSql110Parser(true);
    IList<ParseError> errors;
    TSqlFragment fragment = parser.Parse(reader, out errors);
    if (errors != null && errors.Count > 0)
    {
        foreach (ParseError error in errors)
        {
            Console.WriteLine("Line: {0}, Column: {1}: {2}", error.Line, error.Column, error.Message);
            return;
        }
    }

    SqlScriptGenerator sqlScriptGenerator = new Sql110ScriptGenerator();
    TSqlScript sqlScript = fragment as TSqlScript;
    if (sqlScript == null)
    {
        sqlScriptGenerator.GenerateScript(fragment, Console.Out); // TODO execute the script
    }
    else
    {
        foreach (var sqlBatch in sqlScript.Batches)
        {
            Console.WriteLine("-- ");
            sqlScriptGenerator.GenerateScript(sqlBatch, Console.Out); // TODO execute the script
        }
    }
}
Haresh Vazir