JayceOoi.com

- Technology, mobile, photography, gaming, programming, anything -

After adding linked server on Microsoft SQL 2008, it’s time to query data from it. So how to query data from linked server on Microsoft SQL 2008?

Just run below query…

SELECT * FROM OPENQUERY
(LinkedServerName,’SELECT * FROM master.sys.servers‘)
GO

LinkedServerName is the linked server that you want to query from. And replace the query statement with your own query. Then you are ready to go.

Want to query data from other database server like Oracle, Access, IBM DB2 or even Microsoft Excel Spreadsheet, ODBC data source and file system? All you need to do is to add them as linked server on Microsoft SQL 2008. And remote stored procedures can be executed too.

Run below queries to add linked server

EXEC master.dbo.sp_addlinkedserver @server = N’ServerName‘, @provider = N’SQLOLEDB’, @datasrc = N’DataSource‘, @srvproduct=”

EXEC master.dbo.sp_addlinkedsrvlogin @rmtsrvname=N’ServerName‘,@useself=N’False’,@locallogin=NULL,@rmtuser=N’UserName‘,@rmtpassword=’Password

sp_addlinkedserver is used to create a linked server.
sp_addlinkedsrvlogin is used to create login on the linked server.
That’s all.




Featured ...

Slicepad Pocket Projector Review
64GB SanDisk Extreme microSDXC UHS-I Card Review
64GB Samsung microSDXC Pro UHS-1 Card Review

Guide for ...

Samsung Galaxy Note 3
Google Nexus 7 (2013)
Samsung Galaxy S4
Google Nexus 4
Samsung Galaxy Note 2
Google Nexus 7
Samsung Galaxy S3
HTC One X
Amazon Kindle Fire
Samsung Galaxy S2
HTC HD2

Follow ...