Open richardgavel opened 2 years ago
@richardgavel can you please add more info? Are you using sqlpackage.exe or DacFx framework?
DacFx framework, This is basically the result of sql -> syntax tree -> sql
string sql = "...";
var parser = new TSql150Parser(true, SqlEngineType.All);
var tree = parser.Parse(new StringReader(sql), out _);
var generator = new Sql150ScriptGenerator();
generator.GenerateScript(tree, out string script);
sql: Has the second part of the union script: Missing the second part of the union.
@richardgavel - this does not reproduce with current ScriptDom nuget 161.8812.0.
Could you please re-visit your repro and let us know if there is any other issue?
When I parse a query which has a UNION statement, I get a SelectStatement with a QueryExpression that is a BinaryQueryExpression. However, when I try to use the SqlScriptGenerator to regenerate the SQL from the object tree, it stops at the FirstExpression + BinaryQueryExpressionType.
eg. => SELECT x FROM FOO UNION SELECT x FROM BAR turns into SELECT x FROM FOO UNION