Accessing remotely through views

  • Hi All

    I am new to sql world. I want to access remote server database through the views on my local system database. Please help.

    Sac

  • You need to create a linked server using sp_addlinkedserver procedure

    EXEC sp_addlinkedserver

    @server='TestServer',

    @srvproduct='',

    @provider='SQLNCLI',

    @datasrc='YourServer\InstanceName'

    Then, create linker server login

    EXEC sp_addlinkedsrvlogin 'TestServer', 'false', 'sa', 'sa', 'password'

    Thats it.

    Now query the server,

    select * from TestServer.master.dbo.sysobjects

    --Ramesh


  • Ramesh,

    You can also use opendatasource to query remote servers. try that if u need it only for the hour else go for linked servers for permanent solution.

    Cheers,
    Sugeshkumar Rajendran
    SQL Server MVP
    http://sugeshkr.blogspot.com

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply