Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Query Order Expand / Collapse
Author
Message
Posted Tuesday, September 8, 2009 6:06 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Monday, September 13, 2010 12:40 PM
Points: 20, Visits: 56

I am having 3 databases in SQL server 2000.
(2 databases are in one server ither one in different server)
In that i ran one query in all databases.
i am getting same order of data for evey run in 2 databases.
But in one environment i will get differnt order of data whan each run.


Can you please anybody help me?
Post #784167
Posted Tuesday, September 8, 2009 6:11 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 5:00 AM
Points: 5,014, Visits: 10,513
To ensure the results are always sorted in the same way you have to add an ORDER BY clause.
If you don't provide an explicit order, results are not sorted in a predictable way.


--
Gianluca Sartori

Get your two-cent-answer quickly
spaghettidba.com
@spaghettidba
Post #784168
Posted Tuesday, September 8, 2009 1:44 PM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 1:22 PM
Points: 11,148, Visits: 12,889
You also need to take into account collation. Are they all the same?



Jack Corbett

Applications Developer

Don't let the good be the enemy of the best. -- Paul Fleming

Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
How to Post Performance Problems
Crosstabs and Pivots or How to turn rows into columns Part 1
Crosstabs and Pivots or How to turn rows into columns Part 2
Post #784544
Posted Tuesday, September 8, 2009 11:44 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Monday, September 13, 2010 12:40 PM
Points: 20, Visits: 56
I didn't explicitly added * Order by * in the query.

But how can i get ordered data of every run in 2 databases?

Can you please explain collation ?

I need some more descriptive.


Thanks.
Post #784714
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse