dbTalk Databases Forums  

Is there a way to physically re-order the records in an MS SQL 2005table

comp.databases.ms-sqlserver comp.databases.ms-sqlserver


Discuss Is there a way to physically re-order the records in an MS SQL 2005table in the comp.databases.ms-sqlserver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Markei54545
 
Posts: n/a

Default Is there a way to physically re-order the records in an MS SQL 2005table - 08-10-2010 , 12:19 PM






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

Many thanks

Mark

Reply With Quote
  #2  
Old   
Gert-Jan Strik
 
Posts: n/a

Default Re: Is there a way to physically re-order the records in an MS SQL 2005table - 08-10-2010 , 01:00 PM






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:
Quote:
Is there a way to physically re-order the records in an MS SQL 2005
table?

Many thanks

Mark

Reply With Quote
  #3  
Old   
Erland Sommarskog
 
Posts: n/a

Default Re: Is there a way to physically re-order the records in an MS SQL 2005 table - 08-10-2010 , 02:38 PM



Markei54545 (mark.blackall (AT) gmail (DOT) com) writes:
Quote:
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 (AT) sommarskog (DOT) 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/prodinf...ons/books.mspx

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.