Tuesday, March 20, 2012

Queries Across Servers

Hey all,

Is there a way to qualify a table name or whatever with the SQL name as well? We have serveral SQL Servers and I want to be able to update/query multiple SQL Servers from one statement.

For example:

select * from "is-dbdev".master.dbo.sysfiles

where "is-dbdev" is the name of the server. Can you do this? I have not had any luck thus far...and I get errors when I try to add the other SQL Server as a linked server.

Can anyone help?

Thank you.You have to add the remote server as a linked server, you also have to have a linked server login. Lookup sp_addlinkedserver in BOL.

Once added the syntax is

servername.databasename.ownername.tablename

HTH

No comments:

Post a Comment