Querying a view that's not located on the same server (SQL Server 2005)
-
22-07-2019 - |
Question
I'm trying to query a database view that's not located on the same server as the stored procedure I'm running.
I heard about using "linked servers", but I have no access to the server's configuration at all ...
Thanks in advance !
Solution
Use OPENDATASOURCE:
SELECT *
FROM OPENDATASOURCE(
'SQLOLEDB',
'Data Source=ServerName;User ID=MyUID;Password=MyPass'
).Northwind.dbo.Categories
OTHER TIPS
You can do this, but it does require the DBA to set up the link. If you don't have access to the server's configuration and the DBA is not on board, you're out of luck.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow