• Sioban Krzywicki (4/1/2015)


    ScottPletcher (4/1/2015)


    You can try to get SQL to make the ALTER the task that SQL kills if a deadlock occurs, but I've found it's not 100% effective.

    SET DEADLOCK_PRIORITY -8

    ALTER INDEX ALL REBUILD WITH (SORT_IN_TEMP_DB = ON)

    The "-8" is in case the SELECT already sets its dl_p to "low", then -8 will still be below that.

    I can't imagine wanting to interrupt/kill an index rebuild, but thanks.

    Really, "can't imagine" it? I'd rather have a rebuild killed than a critical production job even just SELECTing data, but maybe that's just me.

    SQL DBA,SQL Server MVP(07, 08, 09) A socialist is someone who will give you the shirt off *someone else's* back.