none
Linked server with SQL Server Authentication

    Question

  • Hello all,

    I am facing some problem while using sp_addlinkedserver.

    My script is shown below:

    EXEC sp_addlinkedserver
       @server = 'LinkServer1',
       @srvproduct = '',
       @provider = 'SQLNCLI',
       @datasrc = 'Enterprise'

    Every things work fine but, when I execute this the new LinkedServer "LinkServer1" automatically fetches the database.

    I want that It should only fetches the database when i entered the username and password for the account, by using 

    sp_addlinkedsrvlogins.

    So, please help me on that


    Pankaj Kumar Yadav-

    Monday, March 12, 2012 3:16 PM

All replies

  • Refer

    http://www.databasejournal.com/features/mssql/article.php/3691721/Setting-up-a-Linked-Server-for-a-Remote-SQL-Server-Instance.htm

    Monday, March 12, 2012 3:37 PM
  • SqlConnection myConnection = new SqlConnection("user id=username;" + "password=password;server=serverurl;" + "Trusted_Connection=yes;" + "database=database; " + "connection timeout=30");

    I think the code above can help you

    Regards, Nighting Liu

    Monday, March 12, 2012 3:38 PM
  • I want that It should only fetches the database when i entered the username and password for the account, by using 

    sp_addlinkedsrvlogins.

    Try this: it removes the default logins:

      exec master.dbo.sp_droplinkedsrvlogin @rmtsrvname='LinkServer1', @locallogin=NULL;

    Dan Jameson
    Manager SQL Server DBA
    CureSearch for Children's Cancer
    http://www.CureSearch.org

    Monday, March 12, 2012 4:34 PM