Skip to content

Commit

Permalink
Fix 'ONLINE' is not a recognized ALTER INDEX REBUILD PARTITION option
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiisyrovatchenko committed Nov 20, 2021
1 parent 5e1b51c commit e0de5ce
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion Server/Index.cs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,9 @@ public string GetQuery() {
(!IsAllowCompression
? ""
: $"DATA_COMPRESSION = {compression}, ") +
$"ONLINE = {onlineRebuild}, " +
(Settings.ServerInfo.MajorVersion <= ServerVersion.Sql2012 && IsPartitioned // 'ONLINE' is not a recognized ALTER INDEX REBUILD PARTITION option
? ""
: $"ONLINE = {onlineRebuild}, ") +
$"MAXDOP = {Settings.Options.MaxDop});";
break;

Expand Down
2 changes: 1 addition & 1 deletion Server/ServerInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public override string ToString() => $"SQL Server {ProductVersion} " +

// https://sqlperformance.com/2014/06/sql-indexes/hotfix-sql-2012-rebuilds
public bool IsOnlineRebuildAvailable => IsAzure
|| (MajorVersion >= ServerVersion.Sql2014 && IsMaxEdititon);
|| (MajorVersion >= ServerVersion.Sql2008 && IsMaxEdititon);

private string ProductVersion {
get {
Expand Down

0 comments on commit e0de5ce

Please sign in to comment.