Add linked server on Microsoft SQL 2008

Add linked server on Microsoft SQL 2008

4

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.

SIMILAR ARTICLES

  • Pingback:   Query linked server on Microsoft SQL 2008()

  • Arshad Hamid

    Is there a way to create a linked server for Excel in Sql Server 2008?

  • saravana

    you ca use this to access data from excel

    select * from OpenRowSet (
    ‘Microsoft.Jet.OLEDB.4.0′,
    ‘Excel 8.0;Database=c:\book1.xls;HDR=YES;IMEX=1′
    ,’select * from [Sheet1$]’)

    c:\book1.xls – your excel

  • bakekart

    Hello I used the script but I can not connect to an Access 2003 database.
    Can you help me?