Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2012
    Posts
    6

    Unanswered: Join Tables in two different SQL servers

    I am logged-in to Server1 using windows authentication and need to connect tables from Server1 with tables from Server2.

    SO i did the following:

    Step 1:
    ======
    USE [master]
    GO
    EXEC master.dbo.sp_addlinkedserver
    @server = N'10.129.176.181',
    @srvproduct=N'SQL Server' ;
    GO

    Step 2:
    =====
    sp_addlinkedsrvlogin @rmtsrvname = '10.129.176.181'
    , @useself = 'FALSE'
    , @locallogin = NULL
    , @rmtuser = 'report'
    , @rmtpassword = 'report'

    Step 3:I am trynig to run a basic query from table on Server2
    =====

    set ansi_nulls on
    set ANSI_WARNINGS on
    select A.Col1 from [Server2].[database2].dbo.[table] A

    when i try the above query , i am ggeting the following error meassge:
    "Heterogeneous queries require the ANSI_NULLS and ANSI_WARNINGS options to be set for the connection. This ensures consistent query semantics. Enable these options and then reissue your query."

    Can anyone please guide if the steps i performed to setup a linked server is fine. ?? WHatelse is wrong on the queries?

    Please help.

  2. #2
    Join Date
    Aug 2004
    Location
    Dallas, Texas
    Posts
    831
    Quote Originally Posted by kelvinroberts View Post
    set ansi_nulls on
    set ANSI_WARNINGS on
    select A.Col1 from [Server2].[database2].dbo.[table] A

    Can anyone please guide if the steps i performed to setup a linked server is fine. ?? WHatelse is wrong on the queries?

    Please help.
    Make sure you have the query options set to OFF and not On. Also check SSMS query options under ANSI and make sure they are set to OFF for the connection.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •