diff --git a/src/EFCore.SqlServer/Migrations/SqlServerMigrationsSqlGenerator.cs b/src/EFCore.SqlServer/Migrations/SqlServerMigrationsSqlGenerator.cs index f4192293658..90f980cf632 100644 --- a/src/EFCore.SqlServer/Migrations/SqlServerMigrationsSqlGenerator.cs +++ b/src/EFCore.SqlServer/Migrations/SqlServerMigrationsSqlGenerator.cs @@ -1453,8 +1453,11 @@ protected override void Generate(SqlOperation operation, IModel? model, Migratio void AppendBatch(string batch) { - builder.Append(batch); - EndStatement(builder, operation.SuppressTransaction); + if (!string.IsNullOrWhiteSpace(batch)) + { + builder.Append(batch); + EndStatement(builder, operation.SuppressTransaction); + } } }