Difference between a linked server and a synonym?
Is there a difference between t-sql linked server and a synonym? If so what are they, and in which cases would I choose one over the other?
You use a linked server to connect to a database on a different server. You use a synonym to specify the object (eg table) you want to access in SQL, it is like an alias. For more info see here.
For example, ServerName.DatabaseName.dbo.TableName
is a synonym for the table TableName
, owned by dbo
, in the database DatabaseName
on the server ServerName
.
A linked server is the other server (or instance) you want to connect to.
Basically, you configure a linked server to access a different database instance. You use synonyms to specify the objects you want to use on the different instance in TSQL.
You can configure a linked server by using SQL Server Management Studio or by using the sp_addlinkedserver
(Transact-SQL) statement. Taken from here.
上一篇: Python 3.4解码字节
下一篇: 链接服务器和同义词之间的区别?