Reply to Re: Create table and default order by clause

Your name:

Reply:


Posted by Plamen Ratchev on 11/26/07 13:59

Hi Davide,

The table is unordered set and you have to explicitly use ORDER BY if you
need to retrieve data in particular order. Even a view will not work, as you
cannot use ORDER BY in a view, unless the TOP clause is specified (and in
that case the ORDER BY is used only to determine the rows returned by the
TOP clause, you still have to use ORDER BY when selecting from the view to
return ordered set).

Since your software controls the creation of the temporary table, it may be
easier to add <sort> column to the table and to populate with values based
on the parameters. Then the report engine can still use static SQL, like
"SELECT <columns> FROM #MyTable ORDER BY sort".

HTH,

Plamen Ratchev
http://www.SQLStudio.com

[Back to original 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

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