• mikej 14403 (7/21/2013)[hrI tested the query's output by using a SELECT DISTINCT query. The output wasn't ordered sequentially in ascending order.

    To get an ordered output, you need to supply an ORDER BY clause. Without it, SQL Server is free to return data in any order.

    [font="Times New Roman"]Erland Sommarskog, SQL Server MVP, www.sommarskog.se[/font]