Ravindra Sinare
Ravindra Sinare

Reputation: 675

Can we use Synonyms in other server?

I am using some old databases so I have work with different servers.

I have created Synonyms on 'A' server and I able to do some operation on that without any problem. Now I want to use it in 'B' server, but it will now allow me access that synonyms in server 'B'. I have given all the access for that server.

Even I able to access the same table which I have created synonyms.

Snippet : On Server 'A' : CREATE SYNONYM [dbo].[EmployeeDB] FOR dbo.Employee

On Server 'B' ; Working with table name : select * from [B].[databaseName].[dbo].[Employee]

Not Working using synonyms name : select * from [B].[databaseName].[dbo].[EmployeeDB]

Upvotes: 3

Views: 2024

Answers (1)

Julien Vavasseur
Julien Vavasseur

Reputation: 3952

No: You cannot reference a synonym that is located on a linked server. https://msdn.microsoft.com/en-us/library/ms187552.aspx

It is probably better to go the other way around (ie. you create a SYNONYM on B which is linked to A) You could also use a view if you want to hide dbo.Employee.

Upvotes: 3

Related Questions