Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
mike123
Master Smack Fu Yak Hacker
1462 Posts |
Posted - 2007-07-19 : 08:39:19
|
Hi,I have a query thats returning results out of order it appears since I upgraded from sql2000 to sql2005. Previously it was working perfectly.I'm wondering what is the best way to fix a query like such is. I read something about temp tables being a cause but I'm not sure my best route for this query. Any direction is much appreciated!Thanks,Mike123Please Ignore query. |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-07-19 : 08:41:40
|
where is the ORDER BY ? KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
mike123
Master Smack Fu Yak Hacker
1462 Posts |
Posted - 2007-07-19 : 09:13:17
|
| Hi Khtan, Sorry after typing up a big response here I just realized I have made a mistake. Everything is actually ok, I was testing against a bad sample. My apologies.I do have one question tho, I am going thru all my SQL2005 SPROCS, and I am trying to identify ones that might be running incorrectly and have gone unnoticed. I did a search for all temp tables and have found a few SPROCS. Is this 2005 change from 2000 that causes some queries to return different results all related to temp tables?Thanks very much! |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-07-19 : 09:23:56
|
You query may still have problem. You uses TOP without ORDER BY. This does not guarantee you will get the correct result. KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
mike123
Master Smack Fu Yak Hacker
1462 Posts |
Posted - 2007-07-19 : 09:45:44
|
| Hi Khtan,Thanks for bringing this to my attention. For this particular case its OK so far, but I think I will take your suggestion because an order by will be an improvement on this query. I originally omitted for speed issues since the query is running 1000's of times, but our db server can handle more load now :)Much appreciated.Mike123 |
 |
|
|
|
|
|
|
|