Re: Regarding Order By Clause In Stored Procedure
- From: "Bob Barrows [MVP]" <reb01501@xxxxxxxxxxxxxxx>
- Date: Mon, 24 Dec 2007 09:50:21 -0500
James Simpson wrote:
Hello again,Again, It is a very bad practice to force the query engine to create a
It would also then work if I just go ASC, due to the way SELECT is
pulling the data, correct? If it pulls from the bottom and I tell it
to order by ascending on the ID, it will give me the results of the
id going from largest to smallest.
sorted resultset of ALL the rows in your table when you are only interested
in the results from a single row. Yes, your idea would "work", but it would
be an incredibly inefficient use of resources. let the query engine do what
it was designed to do: use a WHERE clause when you wish to retrieve a single
row.
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
.
- References:
- Re: Regarding Order By Clause In Stored Procedure
- From: Bob Barrows [MVP]
- Re: Regarding Order By Clause In Stored Procedure
- Prev by Date: Re: Regarding Order By Clause In Stored Procedure
- Next by Date: How to access varbinary field
- Previous by thread: Re: Regarding Order By Clause In Stored Procedure
- Next by thread: How to access varbinary field
- Index(es):