954,566 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Differences between MS SQL and Sybase query results

Hi.

I have strange problem with sql query results. I am joining two tables and displaing result with order by clause. But results on MS SQL and Sybase are different. After removing order by clause in both queries results are equal. I am using the same table so I do not know what is the source of this difference.

krokodajl
Light Poster
31 posts since May 2009
Reputation Points: 10
Solved Threads: 0
 

Maybe they use different collations? Resultset is ordered by the collation you use..

sixer
Newbie Poster
3 posts since Jun 2009
Reputation Points: 10
Solved Threads: 0
 

I think that collations are not used because order attribute is of type smallint

krokodajl
Light Poster
31 posts since May 2009
Reputation Points: 10
Solved Threads: 0
 

OK, I guess the orders are different(or joins), which one is the correct one select and which is not?

sixer
Newbie Poster
3 posts since Jun 2009
Reputation Points: 10
Solved Threads: 0
 

the queries I used in both cases are exactly the same and using the same database.

krokodajl
Light Poster
31 posts since May 2009
Reputation Points: 10
Solved Threads: 0
 

"After removing order by clause in both queries results are equal. I am using the same table so I do not know what is the source of this difference."
When you add ORDER BY which query sorts the resulset correctly (sybase or ms sql)?

sixer
Newbie Poster
3 posts since Jun 2009
Reputation Points: 10
Solved Threads: 0
 

ahh. ok :) I have resultset generated from Sybase query. I have rewritten existing code into T-SQL and results I get are not equal so I think that result from Sybase is correct.

krokodajl
Light Poster
31 posts since May 2009
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You