You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If a script both selects a column as a name using double quotes (i.e. SELECT 1 AS "Test/*") and uses a GO command, the upgrade process will fail with message 'Incorrect syntax near GO'. Removing the GO command, or converting the double quotes to either single quotes or square brackets fixes the issue.
Tested on SqlServer 2016 and 2017.
Code to reproduce:
static void Main(string[] args)
{
var connectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
/*
* SELECT 'Test' AS "Test/*"
* GO
*/
var sql = "SELECT 'Test' AS \"Test/*\"\nGO";
var script = new DbUp.Engine.SqlScript("Tester", sql);
var builder = DbUp.DeployChanges.To
.SqlDatabase(connectionString)
.JournalTo(new NullJournal())
.WithScripts(script)
.WithTransaction()
.LogToConsole()
.Build();
var result = builder.PerformUpgrade();
Debug.Assert(!result.Successful); // Fails
/*
* SELECT 'Test' AS "Test/*"
*/
sql = "SELECT 'Test' AS \"Test/*\"";
script = new DbUp.Engine.SqlScript("Tester", sql);
builder = DbUp.DeployChanges.To
.SqlDatabase(connectionString)
.JournalTo(new NullJournal())
.WithScripts(script)
.WithTransaction()
.LogToConsole()
.Build();
result = builder.PerformUpgrade();
Debug.Assert(result.Successful); // Succeeds
/*
* SELECT 'Test' AS 'Test/*'
* GO
*/
sql = "SELECT 'Test' AS 'Test/*'\nGO";
script = new DbUp.Engine.SqlScript("Tester", sql);
builder = DbUp.DeployChanges.To
.SqlDatabase(connectionString)
.WithScripts(script)
.JournalTo(new NullJournal())
.WithTransaction()
.LogToConsole()
.Build();
result = builder.PerformUpgrade();
Debug.Assert(result.Successful); // Succeeds
}
}
The text was updated successfully, but these errors were encountered:
If a script both selects a column as a name using double quotes (i.e. SELECT 1 AS "Test/*") and uses a GO command, the upgrade process will fail with message 'Incorrect syntax near GO'. Removing the GO command, or converting the double quotes to either single quotes or square brackets fixes the issue.
Tested on SqlServer 2016 and 2017.
Code to reproduce:
The text was updated successfully, but these errors were encountered: