• Found unicode characters in the script, otherwise was fine.

    Added FILLFACTOR to the script - important!

    1. added declaration at the top:

    declare @fillfactor int

    2.Added the assignation just above the comment shown here:

    select @fillfactor = isnull(fill_factor,90) from sys.indexes where object_id = @idxid

    -- Get the number of cols in the index

    3. Then modified the beginning of the "build the options" section:

    -- Build the options

    set @sParamSQL = ' WITH (FILLFACTOR = ' + cast(isnull(@fillfactor,90) as varchar(3)) + ', '