November 29, 2010 at 3:39 am
Had an interesting problem last week with a .Net Application was showing the result set of a SP in a unsorted / jumbled order. I profiled the SQL calls , and when I ran the same SP standalone on the same DB within Management Studio the result set was fine, i.e in a sorted order as per expected.
Interstingly the SP did not have a ORDER by on the selection , and indeed adding a order by did resolve the problem.
I have never seen this behaviour before, and am somewhat bemused
Thanks
November 29, 2010 at 3:59 am
If there is no order by specified, SQL is under absolutely no obligation to return the data in any particular order. it depends what operators end up in the execution plan.
What you probably got was a different exec plan for the two calls, due to different parameter values or different set options.
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
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply