Link to home
Start Free TrialLog in
Avatar of alirezakaveh
alirezakavehFlag for United Arab Emirates

asked on

Creating View from another SQL server into your local SQL server

Hi Experts
I am looking for a way to read some table from another SQL server and storing it to my local SQL server, that is why i want to make a View in my local database to read another SQL sever, but i have no idea how to achieve this.
Thanks
Avatar of Dale Burrell
Dale Burrell
Flag of New Zealand image

To be clear a view doesn't copy the data, just provides a view to it...
CREATE view dbo.MyView
as
select Column1, Column2, Column13, ...
from OtherServerName.dbo.TableName -- assuming dbo is the owner name
GO

Open in new window

Avatar of Guy Hengel [angelIII / a3]
>to read some table from another SQL server
you can achieve that using a linked server, for ad-hoc queries.
http://msdn.microsoft.com/en-us/library/ms188279.aspx

>and storing it to my local SQL server,
you could INSERT into a local table reading from the linked server using above.
but depending on the actual needs, you might be happier with replication, for example.
ASKER CERTIFIED SOLUTION
Avatar of waheedk
waheedk
Flag of Pakistan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Doh... sorry my code shows how to grab data from another database... not another server.