diff --git a/src/GetSqlServerVersionInfo/Program.cs b/src/GetSqlServerVersionInfo/Program.cs index 24fc973..b2f37de 100644 --- a/src/GetSqlServerVersionInfo/Program.cs +++ b/src/GetSqlServerVersionInfo/Program.cs @@ -194,7 +194,7 @@ private static string BuildSqlScript(List builds) { var sqlScript = new StringBuilder(); sqlScript.AppendLine(@" -IF NOT EXISTS (SELECT NULL FROM sys.tables WHERE [name] = 'SqlServerVersions') +IF (OBJECT_ID('dbo.SqlServerVersions') IS NULL) BEGIN CREATE TABLE dbo.SqlServerVersions @@ -218,6 +218,7 @@ ReleaseDate ASC ); END; +GO DELETE dbo.SqlServerVersions;" ); @@ -233,7 +234,9 @@ INSERT INTO dbo.SqlServerVersions } // Remove the trailing comma sqlScript.Remove(sqlScript.Length - 1, 1); - sqlScript.Append(';'); + sqlScript.Append(@" +; +GO"); return sqlScript.ToString(); }