Alan Warren
asked on
Return an Unsorted resultset when using UNION ALL in a Stored Procedure
Trying to return a UNION ALL resultset from a Stored Procedure that is UNSORTED
If I test this in query analyser the resultset is unsorted, but if I execute the sproc the resultset is sorted 1-9.
Thanks for your response
Alan ";0)
eg...
Select ID From table1 where ID <= 5
UNION ALL
Select ID From table1 where ID > 5
Expected results:
========================== ==
5
6
7
8
9
1
2
3
4
========================== ==
Actual Results:
========================== ==
1
2
3
4
5
6
7
8
9
========================== ==
If I test this in query analyser the resultset is unsorted, but if I execute the sproc the resultset is sorted 1-9.
Thanks for your response
Alan ";0)
eg...
Select ID From table1 where ID <= 5
UNION ALL
Select ID From table1 where ID > 5
Expected results:
==========================
5
6
7
8
9
1
2
3
4
==========================
Actual Results:
==========================
1
2
3
4
5
6
7
8
9
==========================
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
take care...
Alan