Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 My question about Linked Server

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-05-21 : 09:13:50
Frank writes "When I use a Linked Server in a VB project, I need write
some code to check whether the Linked Server is local
server or not. How can I get the information from its
property?"

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-05-21 : 09:27:47
Um, why would you set up the local server as a linked server? That doesn't make any sense to me.

A SQL Server can create links to other servers, so that you can perform SQL operations on them as if they were regular servers. This is the syntax used:

SELECT * FROM servername.database.owner.tablename
SELECT * FROM serverB.db1.owner.table1


You would set up ServerA to have a linked server to ServerB. Once you do that, you can connect to ServerA and run the code example to get data from ServerB. If you only want data from ServerA, you can exclude the server name part from your SELECT statement.

Go to Top of Page

fliao
Starting Member

1 Post

Posted - 2002-05-21 : 22:20:38
My code is one of a big project which is developed by some guys.
The code that create a linked server is writen by another guy.
What I got is just a linked server name. I don't know which
server will be connected, maybe to a local server which named
loopback linked servers, maybe not.
But based on microsoft document, "Loopback linked servers
cannot be used in a distributed transaction. ", so I need
check the linked server whether it is loopback linked servers
or not, then I can write the sql statement as Rob's suggestion.

quote:

Um, why would you set up the local server as a linked server? That doesn't make any sense to me.

A SQL Server can create links to other servers, so that you can perform SQL operations on them as if they were regular servers. This is the syntax used:

SELECT * FROM servername.database.owner.tablename
SELECT * FROM serverB.db1.owner.table1


You would set up ServerA to have a linked server to ServerB. Once you do that, you can connect to ServerA and run the code example to get data from ServerB. If you only want data from ServerA, you can exclude the server name part from your SELECT statement.





Go to Top of Page
   

- Advertisement -