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 2005 Forums
 Transact-SQL (2005)
 query across servers

Author  Topic 

collie
Constraint Violating Yak Guru

400 Posts

Posted - 2008-01-10 : 11:36:54

hi

I have a sp that calls 2 different tables. The problem is that the tables are in 2 different servers.

dbo.PLCentersDim_temp table is located in server bs/sql_2005 database AHTDW
AHT.dbo.Accounts table is located in server bsserver1/bs database ATH.

How can I call the 2 tables from the different servers?

Thanks







insert dbo.PLCentersDim_temp


SELECT

case when country like '%Rus%' then CAST('RUSSIA' AS NCHAR (20))
when country like '%U.S%' then CAST('NorthAmerica' AS NCHAR (20))

ELSE CAST('General PLCenter' AS NCHAR (20))

END as PLCenter
FROM AHT.dbo.Accounts
WHERE
AHT.dbo.Accounts.accountkey in
(select customercode from dbo.SalesFactTable_temp) and sortgroup IN (455)
end



Whisky-my beloved dog who died suddenly on the 29/06/06-I miss u so much.

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-01-10 : 11:40:48
Used OPENDATASOURCE or linked server methods

[url]http://msdn2.microsoft.com/en-us/library/aa213283.aspx[/url]
Go to Top of Page
   

- Advertisement -