问题
How to create a linked server...?
1st Server name is ABC.DATABASE1
2nd server name is EFG.DATABASE2
EFG database username is sa password is sa
I want to retrive the data's from 2nd server thourgh 1st server
In the 1st server, i exectue the store procedure like this....
exec sp_linkedserver 'EFG'
Executed successfully,
When i tried to retrive the data, it is showing error as "login failed for user sa, Reason: Not associated with trusted sql server connection"
How to solve this problem...
Need help
回答1:
In Microsoft SQL Server Management Studio check the login configuration of your linked servers properties on the *Security" tab and create a mapped remote login for your local sa account or configure an alternative login for all connections.
To create a linked server with a login mapping by executing sp_linkedserver, try
sp_addlinkedsrvlogin @rmtsrvname = N'EFG', @locallogin = N'sa', @useself = N'False',
@rmtuser = N'your_remote_user', @rmtpassword = N'remotepassword'
To create a linked server with an alternative login, try
sp_addlinkedsrvlogin @rmtsrvname = N'EFG', @locallogin = NULL , @useself = N'False',
@rmtuser = N'your_remote_user', @rmtpassword = N'remotepassword'
来源:https://stackoverflow.com/questions/10569936/login-failed-for-linked-server