sp_addlinkedsrvlogin doesn't work but sp_addlinkedserver does?
sql, sql-server
Solution
I have understood the two prodcecures to be the same
Incorrect. `sp_addlinkedsrvlogin` is documented as:
Creates or updates a mapping between a login on the local instance of SQL Server and a security account on a remote server.
Nowhere is said that it creates a linked server. In fact the very first argument is properly documented as:
`@rmtsrvname` Is the name of a linked server that the login mapping applies to
You first create the linked server via `sp_addlinkedserver`, you then add the linked server login via `sp_addlinkedsrvlogin`.
Problem
I can add a link server with EXEC sp_addlinkedserver, (With no credentials) successfully, however, I need to provide a username and password to a server if the Windows Authentication doesn't work. So I have tried using ``` EXEC sp_addlinkedsrvlogin @rmtsrvname='ServerName', @useself=N'False', @locallogin=NULL, @rmtuser='sa', @rmtpassword='Password' ``` Which this error appears Msg 15015, Level 16, State 1, Procedure sp_addlinkedsrvlogin, Line 49 The server 'ServerName' does not exist. Use sp_helpserver to show available servers . I dont understand as looking online, I have understood the two prodcecures to be the same, but sp_addlinkedsrvlogin takes a username and password and then creates the link server. I guess I have this wrong? So if I have, is there a SQL Server Procedure that will do what I want? Cheers