![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I have sqlserver 2008, called 'Server A'. It has a linked server setup. How do I select from table in the linked server from 'Server A'. I can so it with Use, but my select statement ref tables from both servers. |
#3
| |||
| |||
|
|
Phil Hunt (aaa (AT) aaa (DOT) com) writes: I have sqlserver 2008, called 'Server A'. It has a linked server setup. How do I select from table in the linked server from 'Server A'. I can so it with Use, but my select statement ref tables from both servers. SELECT .. FROM thelinkedserver.thatdb.dbo.thattbl a JOIN yourlocaltbl b ON a.somekey = b.somekey -- Erland Sommarskog, SQL Server MVP, esquel (AT) sommarskog (DOT) se Links for SQL Server Books Online: SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx |
#4
| |||
| |||
|
|
I am doing this from the Studio, what you wrote does not work. Do I need OPENQUERY ? That's what I found when I google |
#5
| |||
| |||
|
|
Phil Hunt (aaa (AT) aaa (DOT) com) writes: I am doing this from the Studio, what you wrote does not work. Do I need OPENQUERY ? That's what I found when I google Since I just made up the table names and the query pattern, I am not surprised that the query didn't work. Then again, you were supposed to adapt the pattern to you query and work from there. All I know now is that you have a query (well, at least I assume that you have) and it "does not work". But I know how that query looks like, I don't know what "does not work" means. Thus, I'm quite of my powers to help you, unless you help me to help you. Please post your query, and explain why you are not satisfied with it. If you get an error message, please include the error message. |
#6
| |||
| |||
|
|
Phil Hunt (aaa (AT) aaa (DOT) com) writes: I am doing this from the Studio, what you wrote does not work. Do I need OPENQUERY ? That's what I found when I google Since I just made up the table names and the query pattern, I am not surprised that the query didn't work. Then again, you were supposed to adapt the pattern to you query and work from there. All I know now is that you have a query (well, at least I assume that you have) and it "does not work". But I know how that query looks like, I don't know what "does not work" means. Thus, I'm quite of my powers to help you, unless you help me to help you. Please post your query, and explain why you are not satisfied with it. If you get an error message, please include the error message. -- Erland Sommarskog, SQL Server MVP, esquel (AT) sommarskog (DOT) se Links for SQL Server Books Online: SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx |
![]() |
| Thread Tools | |
| Display Modes | |
| |