Re: SQL 2000 manual start job sort order

From: Tibor Karaszi (tibor_please.no.email_karaszi_at_hotmail.nomail.com)
Date: 06/23/04


Date: Wed, 23 Jun 2004 15:22:06 +0200

As you might know, without ORDER BY, SQL Server is free to optimize and execute a query in any way
it like. I.e., rows can be returned in any order. If you add ORDER BY, then the optimizer has to
create an execution plan that returns the rows in that order. It is no unusual to find that a
developer forgot to add ORDER BY as the optimizer happened to execute the query in a way that you
indeed received the rows in a correct order. But as you have more data in the table, etc, the
optimizer might find it more efficient to execute the query in some other way, and the result is no
longer ordered in that way (because of the missing ORDER BY). According to Vyas' post, this is what
has happened here. I.e., if this is what we are seeing, there's no need to worry about data
corruption.

-- 
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"kevin" <anonymous@discussions.microsoft.com> wrote in message
news:1ffe301c45922$ba077eb0$a601280a@phx.gbl...
> Uri, up till last week, everything was fine.  But now, if
> I open the properties of the job, the steps are still
> correctly listed in numerical order.  But, if I try to
> start the job manually, the dialog box opens and voila!
> they're listed alphabetically by job step name.  Weird.
> I'm just wondering if this implies corruption in any way.
> thanks
> k
> >-----Original Message-----
> >Hi ,Vyas
> >What is the procedure?
> >EXEC sp_help_jobstep @job_name = 'Backup' seems to
> returned a right order of
> >steps ?
> >
> >"Narayana Vyas Kondreddi" <answer_me@hotmail.com> wrote
> in message
> >news:OQPHpBSWEHA.2168@TK2MSFTNGP10.phx.gbl...
> >> I am not sure if this is in the KB, but it is a bug
> with the stored proc
> >> that returns the job steps. The developer forgot to
> put an ORDER
> >BY...oops!
> >> -- 
> >> HTH,
> >> Vyas, MVP (SQL Server)
> >> http://vyaskn.tripod.com/
> >> Is .NET important for a database professional?
> >> http://vyaskn.tripod.com/poll.htm
> >>
> >>
> >> "kevin" <anonymous@discussions.microsoft.com> wrote in
> message
> >> news:204e101c4591e$1510a5c0$a101280a@phx.gbl...
> >> Hello - I am wondering if anyone else experienced this:
> >> Last week, one of my DBAs wanted to start a job
> manually,
> >> right-clicked on the job, got a step list back with
> >> request to click on step to start on.  Oddly enough,
> the
> >> list was not sorted numerically (as it usually is) but
> >> alphabetically.  How can this be fixed and does this
> >> necessarily indicate any further problems?  Thanks in
> >> advance.
> >>
> >>
> >
> >
> >.
> >


Relevant Pages

  • Re: SQL Query Performance
    ... Execute the query and see which is faster. ... I support the Professional Association of SQL Server and it's community of SQL Server professionals. ... > I want to select Fleet_Id and Fleet_Name from fleet table> Where the current user has privilege. ...
    (microsoft.public.sqlserver.programming)
  • Re: Usage of Views
    ... Can you please suggest any way to understand the details about the optimized query? ... > I support the Professional Association for SQL Server ... Would there be any chance of optimizer applying the operations ... > final desired output? ...
    (microsoft.public.sqlserver.server)
  • Re: SQL 2000 manual start job sort order
    ... The optimizer decided to go for another execution plan, ... Tibor Karaszi, SQL Server MVP ... > happened to execute the query in a way that you ...
    (microsoft.public.sqlserver.server)
  • SQL Server 2005 with iSeries DB2 Linked Server problem
    ... I have the linked serverset up and and I can execute the ... following query from the SQL Server Management Studio and it works ... I can even create a view of the query in my Master ... database and it works from the SQL Server. ...
    (microsoft.public.sqlserver.connect)
  • Re: Matching on a subquery with multiple columns
    ... >online under exist that all IN queries can be expressed as EXISTS queries. ... depending on the quality of the optimizer of a DBMS, ... result as a temp table and use that while evauating the outer query. ... A dumb optimizer will not recognise this and execute ...
    (microsoft.public.sqlserver.programming)