SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 help querying local and remote instances
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

lcsgeek
Starting Member

USA
38 Posts

Posted - 05/21/2012 :  09:32:42  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

USA
2868 Posts

Posted - 05/21/2012 :  11:03:35  Show Profile  Reply with Quote
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

USA
38 Posts

Posted - 05/23/2012 :  14:37:29  Show Profile  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.07 seconds. Powered By: Snitz Forums 2000