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
 SQL Server Administration (2005)
 Selecting from a linked table

Author  Topic 

bendertez
Yak Posting Veteran

94 Posts

Posted - 2008-06-20 : 06:56:54
Hi

I've created a linked table connection to an external data source within sql server 2005.

The link looks OK, I can see all the tables etc, but I want to create a view on another database to some of the tables on the linked database.

How do I perform something as simple as a select statement as I can't seem to be able to select anything.

Is there something that i need to do first in order to be able to select fields from the linked table?

Thanks

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2008-06-20 : 07:43:10
Are you talking about linked server?

You can use following four part naming syntax to access tables in linked server:

select * from <linked-server-name>.<database-name>.<owner-name>.<table-name>


Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

mdubey
Posting Yak Master

133 Posts

Posted - 2008-06-20 : 16:46:38
Thanks Harsh,

Whenever you use linked server make sure you should have to use four part connection name.

ex. 1) Server name
2) DB name
3) Owner Name
4) Object name.

Suppose select * from ABCD.DB.DBO.TBLThis is your actual query.

select * from ABCD(SERVER_NAME).DB(DB_NAME).DBO(Owner_Name).TBL(Object_Name).



Manoj
MCP, MCTS
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-06-20 : 16:49:09
mdubey,

How does your post provide any additional information to what Harsh already posted? Why do you repeat what other people have already answered?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -