Results 1 to 6 of 6
  1. #1
    Join Date
    Mar 2007
    Posts
    167

    Unanswered: Rows in Database B seem to be in a different order than Database A (origin database).

    Database dump and load problems (dump database A and load it in databaase B). Rows in Database B seem to be in a different order than Database A (origin database).

    We are experiencing something interesting... The application support team claims that when they perform a database dump from one database and load it into another database, that the table rows are displayed in a different order when they do a sql select statement. They claim that statement is identical, but the display order is different. For example...

    Database A (table 01)

    prodnum
    -------
    1
    2
    3

    Database B (table 01)

    prodnum
    -------
    2
    1
    3

    They are asking if the database load, loads the database table rows in a different order? So when they do a sql select statement, the rows are displayed in a different order.

    Is this true? Do you think that the database load doesn't load the table rows in the exact order as the source database? What are your thoughts?

    Many thanks for your help.

  2. #2
    Join Date
    May 2005
    Location
    South Africa
    Posts
    1,365
    Provided Answers: 1
    The order of the data in the database has no meaning
    If you want data to be displayed in a certain order then you MUST use an "order by" in your select statement.

  3. #3
    Join Date
    Mar 2007
    Posts
    167

    thank you for your response...

    Just a quick note to thank you for your response.

    Now that you mention it... makes me feel much better about my response to them. They were making it as if it was a database bug or problem. No matter how much I told them that it was their code that was the problem, they kept blaming the database load.

    I talked to them again today and sure enough they were doing a simple / straight sql statement. With no "order by" or anything. So of course the date isn't going to be the way they wanted. Unfortunately, they did this throgout their entire application, so it will be fun to see how they get out of this one.

    Many thanks...

  4. #4
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    They have a couple of options...
    Create a view which is a snapshot of the data in the existing table with an order by clause declared. Then do a find and replace in the project to replace the table name with the ordered view name.

    That seems quite eloquent in my head
    George
    Home | Blog

  5. #5
    Join Date
    Jun 2007
    Location
    London
    Posts
    2,527
    It may also be worth checking to see if there's the clustered index on both tables and that they are both the same. Clustering doesn't guarentee a particular order but it does tend to follow the order of this index.

  6. #6
    Join Date
    Mar 2007
    Posts
    167

    Thank you... :)

    Guys, thanks a million for help and feedback. Your ideas and feedback have been very helpful.

    Thank you.

Posting Permissions

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