Re: Create table and default order by clause
- From: "Plamen Ratchev" <Plamen@xxxxxxxxxxxxx>
- Date: Mon, 26 Nov 2007 08:59:51 -0500
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
.
- References:
- Prev by Date: Re: Concat instead of SUM when grouping results
- Next by Date: Re: TRUNCATE TABLE @table_name
- Previous by thread: Re: Create table and default order by clause
- Next by thread: Re: Create table and default order by clause
- Index(es):
Relevant Pages
|