Re: Sorting Problem
From: Vishal Parkar (REMOVE_THIS_vgparkar_at_yahoo.co.in)
Date: 06/30/04
- Next message: anonymous_at_discussions.microsoft.com: "Update First Instance"
- Previous message: Nikola Milic: "xp_sendmail with two attached files"
- Maybe in reply to: nomi: "Re: Sorting Problem"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 30 Jun 2004 16:05:53 +0530
hi nomi,
>>The result set aways has a different order. The problem occurs in the
insert into statement,
it does not insert the data in sorted order inspite of order by clause.
i Have created STable with the following script.<<
Remember that table is an unordered set of rows. physical ordering of rows
does not gurantee the retrieval order of
the rows in SELECT statement. Only way to get ordered result is by using
"order by" clause statement in the SELECT
statement.
So to get required resultset in specific order make use of "order by"
clause.
if you fire following query, then resulset will be sorted on the basis of
COUNTER column that is what i can see in the resulset you've posted.
select counter,
CCode,
field1,
field2
FROM STable
WHERE sid=@sid
and stypeid=6
order by counter
-- Vishal Parkar vgparkar@yahoo.co.in | vgparkar@hotmail.com
- Next message: anonymous_at_discussions.microsoft.com: "Update First Instance"
- Previous message: Nikola Milic: "xp_sendmail with two attached files"
- Maybe in reply to: nomi: "Re: Sorting Problem"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|