There is a behavioral change in the SQL Server UNION operator from version starting from 2005.
In versions prior to SQL Server 2005, the union operator would not only remove duplicates but also order the resultset by the first column.
select 2 as number
union
select 1
and observe the results. The result set is ordered by number in an ascending order

But the same code will not order the result set in version 2005. Run the same code and see the result set

Now run same query in SQL 2008, and observe the results! Also note that when there is a duplicate, union will behave the same way in all versions.
Did you like this post?
|
|
|
||
|
|
|
|
|
|
|
subscribe via rss |
|
subscribe via e-mail |
|
|
print this post |
|
follow me on twitter |




comments
0 Responses to "SQL Server: Behavioral Change in Union Operator"Post a Comment