• tinausa - Wednesday, June 28, 2017 2:47 PM

    Thanks for confirming what I was thinking. Then is there a way that I can force the order? 

    With an ORDER BY clause. Doesn't have to be a straight order by name. You can have an expression in the ORDER BY, or add another column to the temp table with the required order, but that's how you force an order.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass