@datasrc with this, I found that you can completely avoid using the User ID property by using @datasrc instead of @provstr . This is very poorly documented, but the example below works for me:
EXEC master.dbo.sp_addlinkedserver @server = 'SOME_NAME', @srvproduct='', -- needs to be explicitly empty, default is NULL and is not allowed @datasrc='some_server.com\SOME_INSTANCE', @provider='SQLNCLI'; -- Set up the Linked server to pass along login credentials EXEC master.dbo.sp_addlinkedsrvlogin @rmtsrvname='SOME_NAME', @useself='true', -- Optional. This is the default @locallogin=NULL; -- Optional. This is the default
Using this method, you can reuse the same linked server for all your users. Currently, the accepted answer has a huge drawback in that you need to set up a separate linked server for each user.
source share