You are here: Re: Order by in a INSERT INTO..SELECT « MsSQL Server « IT news, forums, messages
Re: Order by in a INSERT INTO..SELECT

Posted by Erland Sommarskog on 04/23/06 13:46

David Portas (REMOVE_BEFORE_REPLYING_dportas@acm.org) writes:
> In your example you try to force a particular execution plan onto your
> code using an INDEX hint. But there is absolutely no reason why SQL
> Server should always be required to implement a hint. Indexes are
> intended as an optimization tool - they are not supposed to affect
> logical behaviour of code.

I only like to enforce this: if the result of a query is dependent on
the presense of an index, the result of the query is undefined (or there
is a plain bug). The task of indexes is to decrease execution times, but
they should not affect the outcome of a query.

Of course, by adding an index hint you at least ensure that they query
will fail would the index be dropped. Then again, if someone changes
the index, you lose anyway.



--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация