Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2000 > SQL Server 2000
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 16th, 2005, 02:49 PM
Registered User
 
Join Date: Mar 2005
Location: San Rafael, CA, .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Default sort changes after restore on new machine

Hi,

I migrated a database using backup/restore. On the new machine, a select * from one of the tables will not be in order of the index (a clustered index based on the column1, asc., it's an int 4, identity column). The sort order is the same on both machines.

The results returned by this table from a select * are different from the table on the other machine. On the new machine, the ordering does not begin at 1 for some reason, although it is sequential, there are 119 records at the beginning before it starts with 1. On the older machine, it starts with 1. Despite the fact that they shouldn't be using a select *, I guess some developers have used datasets that depend on the data being in this order. Using select top 10 returns the records in the correct order, I guess SQL Server inserts an order by clause somewhere for this.

Any ideas on how to get the new table to follow the order of the original table?





Reply With Quote
  #2 (permalink)  
Old March 16th, 2005, 03:06 PM
Registered User
 
Join Date: Mar 2005
Location: San Rafael, CA, .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

So DBCC DBREINDEX (mytable, '', 70) fixes the problem...

Is there a way to do this automatically on restore?


Reply With Quote
  #3 (permalink)  
Old March 16th, 2005, 05:02 PM
Registered User
 
Join Date: Mar 2005
Location: San Rafael, CA, .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Doesn't seem to be an option on restore, but I scripted it to occur just after using:

EXEC sp_MSforeachtable

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Retore Db from a remote machine to a local machine srkvellanki BOOK: Beginning SQL 0 October 3rd, 2008 05:17 PM
Dynamic sort order or sort datatype kapy_kal XSLT 2 September 18th, 2007 02:10 PM
how to sort cross tab.sort based on row total joxa83 Crystal Reports 7 March 2nd, 2006 09:12 AM
Unable to sort using xsl sort command sly_jimmy_boy XSLT 3 June 17th, 2005 05:15 AM
how to save & restore default printer settings? Tiffany Pro VB 6 1 April 7th, 2004 06:59 PM



All times are GMT -4. The time now is 03:18 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.