x

How to created a query with two different sever and database

I know how to link two different database , i totally forget how to link to different server in a query... this only join two different database what about the two different sever

SELECT [Name ofdatabase1].[table name].[field name], [Name ofdatabase2]table name].[field name] FROM [Name ofdatabase1].[table name] INNER JOIN [Name ofdatabase2].table name]ON

[Name ofdatabase 1.table name].[field name] = [Name ofdatabase2].[table name].[field name]

more ▼

asked Aug 23, 2011 at 09:24 AM in Default

avatar image

Chama
92 14 16 19

(comments are locked)
10|1200 characters needed characters left

1 answer: sort voted first

if you add the server to your linked server list , then you can write a query like SELECT [ServerName].[Name ofdatabase1].[table name].[field name], [ServerName].[Name ofdatabase2]table name].[field name]

FROM [ServerName].[Name ofdatabase1].[table name] INNER JOIN [ServerName].[Name ofdatabase2].table name]ON

[ServerName].[Name ofdatabase 1.table name].[field name] = [ServerName].[Name ofdatabase2].[table name].[field name]

chk the below link to know more about linked servers

Adding a Linked Server

more ▼

answered Aug 23, 2011 at 09:41 AM

avatar image

aRookieBIdev
2.7k 55 65 71

thank you...i did but i have a error message an expression of non-boolean type specified in a context where a condtion is expectedd near 'INNER'

Aug 23, 2011 at 10:37 AM Chama

Now it is give this errotr invalid object NAME

Aug 24, 2011 at 06:20 AM Chama

Post your actual code.

Aug 24, 2011 at 06:23 AM Magnus Ahlkvist
(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.

Topics:

x2016

asked: Aug 23, 2011 at 09:24 AM

Seen: 560 times

Last Updated: Aug 23, 2011 at 09:45 AM

Copyright 2016 Redgate Software. Privacy Policy