selecting data from another server

  • ok, im working on server a, the test server. server b is the production server. i have admin permissions on both servers. how , from server a do i select data from server b? i keep getting an error saying :

     

    Msg 18456, Level 14, State 1, Line 1

    Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'.

     

    how do i specify what login to use when logging into server b to get the required data?

  •  

    Use the following Query :

    SELECT a.*

    FROM OPENROWSET('SQLOLEDB','<your serv_name>';'server_login';'password',

       'your sql query ') AS a

    Regards,

    Amit Gupta.

     

  • keep getting this error

     

    Msg 18452, Level 14, State 1, Line 1

    Login failed for user EUROPE\v-fintag'. The user is not associated with a trusted SQL Server connection.

     

     

    even though i know i have access to that server

     

    SELECT

    a.*

    FROM

    OPENROWSET('SQLOLEDB','eocopsit02';'EUROPE\rebsites

    '

    ;'*********',

    'selet * from goal ') AS a

     

     

    this is exactly what i executed

  • keep getting this error

     

    Msg 18452, Level 14, State 1, Line 1

    Login failed for user EUROPE\v-fintag'. The user is not associated with a trusted SQL Server connection.

     

     

    even though i know i have access to that server

     

    SELECT

    a.*

    FROM

    OPENROWSET('SQLOLEDB','eocopsit02';'EUROPE\v-fintag

    '

    ;'*********',

    'selet * from goal ') AS a

     

     

    this is exactly what i executed

  •  

    first try to connect direct to that server through

    Query Analyser.

     

    if it is not connected then you have to register the Sql Server.

    You can do it by EM (Enterprise Manager)

     

    Regards,

    Amit Gupta.

     

  • You need to create a linked server connection between the two database servers. Then you will be able to work from one to the other.

    Refer to the BOL for setting up linked servers.

    -SQLBill

  • The easiest ways is to query from Query Analyzer, with first connect to the server you want to query data.

    The other ways, is to add linked server in your master database to be able to connect to the server you want to query data.

    Like this :

    --add the linked server

    exec sp_addlinkedserver @server='MyLocalServer',

    @srvproduct = 'SQLServer OLEDB Provider',

    @provider = 'SQLOLEDB',

    @datasrc = 'servername'

    --query the data

    select orderId, productId, quantity, unitprice

    from MyLocalServer.northwind.dbo.[order details]

    where orderid = 10250

    thanks,

    alexia

     

Viewing 7 posts - 1 through 6 (of 6 total)

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