Reputation: 15384
I have an emergency for which i must give a reply in short time.
I wrote an application that allows the user to query a single sql server db (MyDB from now on).
I assumed that to query other dbs (Oracles, csv, ...) the trick was:
1) creating a linked server on the same server wher the MyDB is
2) on MyDb creating a view that somehow selects data from a table on the linked server
Now I am not sure that (2) is possible. i am trying to create a linked server with Excel but with failure, this is why I asked also this.
So my question is:
is it possible to run
select * from VIEW_WITH_DATA_FROM_LINKED_SERVER
if the connection is made to MyDB and VIEW_WITH_DATA_FROM_LINKED_SERVER
is a view belonging to MyDb?
Thanks!
Upvotes: 0
Views: 104
Reputation: 812
You can create a view using linked server by below query.
USE [SNHU_Reporting] GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE view [dbo].[VIEW_WITH_DATA_FROM_LINKED_SERVER] AS
SELECT * FROM [Servername].db_name.dbo.tablename --dbo is the schema name.
GO
Upvotes: 1