I have a concatenating query:
DECLARE @path NVARCHAR(max)
SELECT @path = ISNULL(@path + \'/\', \'\') + url_segment
FROM navigation_self_and_parents(281
This approach to string concatenation does usually work but it isn't guaranteed.
The official line in the KB article for a similar issue is that "The correct behavior for an aggregate concatenation query is undefined."
There must be some subtle difference between the plans. You can either tweak the query to remove the difference and get the required execution plan or you could/should of course just use XML PATH
as you are on SQL Server 2005 and this is documented to work.