Skip to content

Commit e0de5ce

Browse files
Fix 'ONLINE' is not a recognized ALTER INDEX REBUILD PARTITION option
1 parent 5e1b51c commit e0de5ce

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

Server/Index.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,9 @@ public string GetQuery() {
158158
(!IsAllowCompression
159159
? ""
160160
: $"DATA_COMPRESSION = {compression}, ") +
161-
$"ONLINE = {onlineRebuild}, " +
161+
(Settings.ServerInfo.MajorVersion <= ServerVersion.Sql2012 && IsPartitioned // 'ONLINE' is not a recognized ALTER INDEX REBUILD PARTITION option
162+
? ""
163+
: $"ONLINE = {onlineRebuild}, ") +
162164
$"MAXDOP = {Settings.Options.MaxDop});";
163165
break;
164166

Server/ServerInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public override string ToString() => $"SQL Server {ProductVersion} " +
3636

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

4141
private string ProductVersion {
4242
get {

0 commit comments

Comments
 (0)