Retrieve data by connecting 6 databases | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Retrieve data by connecting 6 databases


Hi, How do I connect to different databases at the same time and retieve the data.
There should not be any performance issue. Please provide the answer to me. With Regards
Aruna Mathew
Are they on the same server?

They are on the different servers.
Tell me if they are on the same server how do I retrieve the data.
quote:Originally posted by aruna_mathew
They are on the different servers.

hi
you should first add the Secondserver as Linkedserver. See BOL for details USE master
GO
EXEC sp_addlinkedserver
‘SecondServerName’,
N’SQL Server’
GO then you can query it and join it with your original server.
select * from SecondServerName.pubs.dbo.authors
cemuney
Tell me if they are on the same server how do I retrieve the data. u should give three part name refering table. You don’t need to connect to all the dbs. from which ever db you are connected, refer other database object using 3 part name. eg. select * from <databasename>.<SchemaName>.<Tablename> Madhu
Make sure user has the access to all 6 dbs…
Mohammed U.
]]>