On 3?20?, ??3?54?, "MC" <marko.culoNOS...@gmail.com> wrote:
> Select as such is not ordered and depending on exec plan you may get
> unordered results. Specify order by in SELECT statement if you wish data to
> bi ordered. You could assume that the data will be retrieved using clustered
> index scan and in that case data should be ordered on the clustered index
> keys. Thats assuming offcourse, and I dont like to assume too much :).
>
> MC
>
> "sali" <s...@euroherc.hr> wrote in message
>
> news:uv$WCGsaHHA.4788@TK2MSFTNGP04.phx.gbl...
>
>
>
> > sql 2000
> > having table tab1 copied into table tab2 with ordered select, like
>
> > select *
> > into tab2
> > from tab1
> > order by key1
>
> > is there some guarrantie that tab2 will then also appear ordered in key1
> > order in subsequent raw selects, like
>
> > select *
> > from tab2
>
> > is there some physical memory or buffer or page limit which may guard
> > resulted tab2 to appear/not appear as ordered?
>
> > thnx- ??????? -
>
> - ??????? -
I test some code here only to find that if a table have no index and
your order by will be valid.
drop table #t
create table #t
(
c1 int,
c2 char(1)
)
insert into #t
select 1,'a'
union select 2,'b'
union select 3,'c'
union select 1,'b'
union select 1,'c'
select * from #t
select * into #tt from #t order by c1
select * from #tt
drop table #tt
select * into #tt from #t order by c2
select * from #tt
drop table #tt
drop table #t