• Suggestion:

    Change the proc so that the indexes are created after the insert is done. That way the reindex won't be needed and you might get around this problem.

    Gail, thanks for your help here too - it's appreciated.

    I was wrong. The indexes are added before the temp table is populated. Here's how it goes:

    The temp table is created, and indexes added. There's a while loop. Stuff is added into the offending temp table. Then the temp table is reindexed (if you want the SP to fail, that is!), then the temp table is joined on as part of the update of another table. The temp table is truncated at the end of (but still inside) the loop.

    So it's possible that the repeated reindexing and truncating is part of the problem. I'll try and have a play with this later.