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)
 help querying local and remote instances

Author  Topic 

lcsgeek
Starting Member

38 Posts

Posted - 2012-05-21 : 09:32:42
We have an offsite hosted SQL Server which houses our Student base. I want to create custom relational tables in my local Express instance to be joined to the remote student table. Within SQL Server Management Studio I have active connections to my local instance as well as the remote server. What is the query join syntax for linking a local table to a remote table?

local table tblTestScores with hypethetical fields
StudentId
TestName
TestGrade

remote table tblStudents with hypethetical fields
StudentId
FirstName
LastName

I want to create a join between these two tables but I don't know the syntax for referencing the remote table. Any assistance would be appreciated. Thanks


jimf
Master Smack Fu Yak Hacker

2875 Posts

Posted - 2012-05-21 : 11:03:35
If you have a linked server to your remote connection
select * from [LinkedServerName].[remoteDatabaseName].schemaName.tableName

Jim

Everyday I learn something that somebody else already knew
Go to Top of Page

lcsgeek
Starting Member

38 Posts

Posted - 2012-05-23 : 14:37:29
Thanks Jim,
When you say linked server to your remote connection do you mean simply using the Connect to Server window when starting Managment Studio or is there a more official connection that I need to make as the Connect to Server connection doesn't persist across restarts of Managment Studio? Thanks again.
Go to Top of Page
   

- Advertisement -