I have tried to create linked server to the remote sql server but when it failed with following error message.
The test connection to the linked server failed.
------------------------------ ADDITIONAL INFORMATION:
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
Login failed. The login is from an untrusted domain and cannot be used with Windows authentication. (Microsoft SQL Server, Error: 18452)
I have followed the instructions from How do I specify a linked server to a remote database over tcp/ip?.
My config settings are
EXEC master.dbo.sp_addlinkedserver
@server = N'TESTSERVER',
@srvproduct = N'SQLServ', -- it’s not a typo: it can’t be “SQLServer”
@provider = N'SQLNCLI',
@datasrc = N'172.x.x.x';
-- Pair local and remote logins
EXEC master.dbo.sp_addlinkedsrvlogin
@rmtsrvname = N'TESTSERVER',
@useself = N'False',
@locallogin = N'Local_user_name',
@rmtuser = N'Remote_user_name',
@rmtpassword = N'Remote_password';
I am able to connect the remote server instance. But it failed when I used that as a linked server in my Local instance.
Please help me resolve the error.
Thanks.
Update
I am able to connect by changing the setting from Be made using the login’s current security context to Be made using this security context
Please let me know why the latter works.
.\Remote_user_name
maybe? Or<ip_address>\Remote_user_name
? And could you please provide the SQL Server version you are using (tag).