• Nice post!

    I would suggest adding the ColId column, from the syscomments table to the #tblTmp table, to ensure reading back the rows from that table in the same order as they were in the syscomments table.

    Thanks for sharing your script!