|
Posted by David Portas on 10/02/02 11:45
drawnai@hotmail.com wrote:
>
> In SQL 2005, use the RowNumber function in a nested sub query.
>
> In SQL 2000, create enough index columns to handle your sort orders.
>
> eg...
> Select Mycol1, MyCol2, Mycol3,
> MyIDX1 = Convert (Int, Null) ,
> MyIDX2 = Convert (Int, Null) ,
> MyIDX3 = Convert (Int, Null)
> into #myResults
> Select blah from whatever order by whatever
>
> contrary to David Portas' assertion this does actually work most of the
> time, however, I sure it can't be relied upon, though I've never seen
> it fail...
What assertion do you mean? All I said was tables are not ordered. They
are not. The example you posted above does not contradict me because
you specified ORDER BY, unlike the OP who had no ORDER BY in his SELECT
statement (only in the INSERT).
Your second example is more suspect. The behaviour of an assignment in
an UPDATE that references multiple rows is undefined.
--
David Portas, SQL Server MVP
Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.
SQL Server Books Online:
http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
--
Navigation:
[Reply to this message]
|