Link to home
Start Free TrialLog in
Avatar of Alan Warren
Alan WarrenFlag for Philippines

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
============================

ASKER CERTIFIED SOLUTION
Avatar of dportas
dportas

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Alan Warren

ASKER

Thankyou, that did the trick, and thanks for the really quick response (the reason I posted max points)

take care...
Alan