|
-
OPENQUERY in a JOIN
What is the correct syntax for using OPENQUERY in a JOIN? For example, how would I use OPENQUERY in the following statement:
SELECT *
FROM server1.database1.dbo.table1 A INNER JOIN server2.database2.dbo.table2 B
ON A.somefield = B.somefield
WHERE A.someotherfield = 'whatever'
When I tried something like this:
SELECT * FROM
OPENQUERY(server1, 'SELECT * FROM database1.dbo.table1 A INNER JOIN server2.database2.dbo.table2 B
ON A.somefield = B.somefield
WHERE A.someotherfield = ''whatever''')
I got this error:
MSDTC on server 'server1' is unavailable.
-
Try this
SELECT * FROM
OPENQUERY(server1, 'SELECT * FROM database1.dbo.table1) as A INNER JOIN server2.database2.dbo.table2 B
ON A.somefield = B.somefield
WHERE A.someotherfield = ''whatever''')
But from the error message it looks like MS Distributed Transaction Coordinator service is not running in Server1.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|