August 3, 2008 at 8:05 pm
Once again.
It does not matter which order you use to insert data into a table.
In most cases it will be resided in the table in different order (depending on table definitions - constraints, idexes, etc.)
And physical order of records in a table does not match order of records returned by SELECT statement. It may be the same for simple queries on small recordsets (as your test one). But it's not the case on real life systems.
So, abandon your attempts to sort records on INSERT. It's absolutely useless exercise.
Think how to define the order of records on SELECT.
_____________
Code for TallyGenerator
August 3, 2008 at 8:21 pm
Sergiy,
Can you give me some idea using Select? appreciate your help
Thx
August 3, 2008 at 8:36 pm
He already did... 😉
SELECT *
FROM #NewTempTable
ORDER BY ID
--Jeff Moden
Change is inevitable... Change for the better is not.
August 3, 2008 at 9:41 pm
I don't want all the rows to be order by that is the thing right. i want only set of rows order by:)
Thx
August 3, 2008 at 9:51 pm
vkres1 (8/3/2008)
I don't want all the rows to be order by that is the thing right. i want only set of rows order by:)Thx
What in your rows groups them into sets?
How can SQL Server tell which rows belong to one set and which to another one?
_____________
Code for TallyGenerator
August 3, 2008 at 10:17 pm
sergiy,
suppose if the C1 = 42 then end of the first set. what i want is i just want to move that row 42 above the 51 in that set so that all will be in the order like
C1 C2 C3
41 te ce
42 te ce
51 te ce
41 te ce
42 te ce
51 te ce
and so on.........
August 4, 2008 at 5:11 am
What about the out of place 41?
--Jeff Moden
Change is inevitable... Change for the better is not.
August 4, 2008 at 10:09 am
The row starts with 41
August 4, 2008 at 5:48 pm
vkres1 (8/4/2008)
The row starts with 41
Heh... Ya Think? What do you want to do with it? 😉
Have you tried the clustered index solution I gave you yet? :blink:
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 9 posts - 16 through 23 (of 23 total)
You must be logged in to reply to this topic. Login to reply