0

In an effort to mimic a production environment I've added a linked server in MSSQL that points to itself. This allows me to test SQL scripts which are run in production on my own machine.

EXEC master.dbo.sp_addlinkedserver
    @server = N'LinkedServer', 
    @srvproduct=N'', 
    @provider=N'SQLNCLI', 
    @provstr=N'DRIVER={SQL Server};Server=(localdb)\MSSQLLocalDb; Initial Catalog=MyOtherDatabase;Integrated Security=true'

This works great when I just open management studio to do queries or run .NET code that does queries while using integrated security.

However when I open management studio using run as administrator, or run .NET code with run as administrator the linked server connection fails.

SQL Server Network Interfaces:  [x89C50118]. 
OLE DB provider "SQLNCLI11" for linked server "LinkedServer" returned message "Login timeout expired".
OLE DB provider "SQLNCLI11" for linked server "LinkedServer" returned message "A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online.".
OLE DB provider "SQLNCLI11" for linked server "LinkedServer" returned message "Invalid connection string attribute". (Microsoft SQL Server, Error: -1983577832)

How can I get this to work?

BennyM
  • 101
  • 5
  • I'm hitting this problem too. Did you ever get a solution? – Shaul Behr Nov 13 '17 at 12:27
  • I think it should not have been possible to even create it. I stopped trying to make this work but I think it was (or was one of the reasons) that I was using a SQLExpress distribution. – BennyM Nov 20 '17 at 09:34

0 Answers0