This has been killing me all day =D. Please help!
Scenario 1: Two DB's on the same server (A, B) and A has three tables. Query is executed from B.
Scenario 2: Two DB's one server is linked to the other. (B has link A) and A has three tables. Query is executed from B.
In scenario 1 (non linked server):
SET @val = ''
SELECT @val = @val + 'Hello, my name is ' + [name] + '!' + CHAR(10) + CHAR(13)
FROM A.sys.tables
Returns: Hello, my name is Table1! Hello, my name is Table2! Hello, my name is Table3!
In scenario 2 (linked server):
SET @val = ''
SELECT @val = @val + 'Hello, my name is ' + [name] + '!' + CHAR(10) + CHAR(13)
FROM LINKED.A.sys.tables
Returns: Hello, my name is Table3!
Why are these different? If I use openquery() on the linked server the results are the same as scenario 1. I'm trying to avoid using openquery() if possible. Thanks!