Hugo,
Now I'm quite embarrassed too - see
http://blogs.lessthandot.com/index.php/DataMgmt/DataDesign/the-ten-most-asked-sql-server-questions--1#4 - the problem is shown and discussed there.
>Hi Naomi, Thanks for the help too
>
>As I told Sergey, the real query is different, I just simplified it to those queries as it is apparently the root of the problem. Running those queries yield the [unexpected?] result, which then is what I believe is the cause of the SP failing too. It makes no sense to me the results of the queries as posted, or I really need vacations.
>
>>I think there is something else. It may be better to post the whole SP. I believe the last query is supposed to return records.
>>
If it's not broken, fix it until it is.
My Blog