Results 1 to 5 of 5
  1. #1
    Join Date
    Jul 2007
    Posts
    4

    Unanswered: display order when table is viewed?

    One of our tables got corrupted, and we ended up pasting data back into the newly created one from an excel spread sheet. One problem though. . . our table was originally sorted in numerical order by a column we called "fID". But when we copied the data into the table, it's no longer sorted by that when we open it to view in sql management studio. How do we get it back to sort by that column, so that it looks like our original table??

  2. #2
    Join Date
    May 2009
    Posts
    508
    Provided Answers: 1
    sharc, in a relational database, there is no inherent order to rows. The only way to ensure rows in a certain order is to use the ORDER BY clause.

    You can try to export the data, sort it in some fashion (possibly with Excel) and then loading the data back into the table. This may give you a display with the rows in an apparent order but there is no guarantee of this.

  3. #3
    Join Date
    Jul 2007
    Posts
    4
    ok thanks so much, I'll try that and see if I can get it to work. . if not, they'll just have to deal with it. .. thanks again!

  4. #4
    Join Date
    Nov 2003
    Posts
    2,935
    Provided Answers: 12
    Just as Stealth_DBA said: just make sure you always use an ORDER BY when retrieving data and you'll never need to worry about things like that again

  5. #5
    Join Date
    Aug 2010
    Posts
    1
    Recently I had similar problem! Thx for sharing this information. I'm new to databases, so I had hard time dealing with MSqlS.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •