• Register
Welcome to SQL Server Planet ASK!, where you can ask questions and receive answers from other members of the community.
Return to SQLServerPlanet.com

I need some kind of book that will provide examples of querying linked data tables.

0 votes
I've created a linked server and I see the tables and am able to select data. I need some kind of book that will provide examples of querying the data.

Example: I need to query information that is need for an IVR. Pass a member to the query and return with lets say a name.

 

All tables needed are on the linked server.

Would it be better to load the data on the server rather than create the linked server?

 

Thanks,

Debra
asked Jan 24 in Transact SQL by anonymous

1 Answer

0 votes
Hi Debra,

From the sound of it, you're fine just keeping the data on the remote server.  The only time you might need to load the data into your local server is if you need to join tables on the linked server with tables on your local server.  When you need to do that it creates a lot of network traffic and is not efficient.

As for the actual queries you need, it sounds like you just need a basic select statement like:

SELECT member_name

FROM members

WHERE memberid = 1234

however since it's on a linked server you need to use the fully qualified name which includes the lined server name:

SELECT member_name

FROM [linkedservername].[databasename].[dbo].members

WHERE memberid = 1234

That should perform the query.  Just replace the names above with your linked server name, and it's database name and it should work.

Derek
answered Jan 24 by derek (230 points)