From: Markei54545 on
Is there a way to physically re-order the records in an MS SQL 2005
table?

Many thanks

Mark
From: Gert-Jan Strik on
The physical order is determined by the clustered index. If your table
does not have a clustered index, then add one.

Having said that, even the clustered index will determine the physical
order only up to a certain point. A particular page will have all the
rows that according to the logical order belong on that page, but might
still physically store them out of order.

Why do you want them to be physically ordered? I hope you realize that
the only way to retrieve the rows in any defined order is by specifying
the order with the ORDER BY clause of the query.
--
Gert-Jan


Markei54545 wrote:
>
> Is there a way to physically re-order the records in an MS SQL 2005
> table?
>
> Many thanks
>
> Mark
From: Erland Sommarskog on
Markei54545 (mark.blackall(a)gmail.com) writes:
> Is there a way to physically re-order the records in an MS SQL 2005
> table?

ALTER INDEX ALL REBUILD ON tbl


--
Erland Sommarskog, SQL Server MVP, esquel(a)sommarskog.se

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000: http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx