SQL Server 2005 synonyms

SQL Server 2005's synonyms allow you to give an alias to an already existing object.

There are two benefits for doing this:

1.You have a very long name for some table, such as OrdersHistoryYear2007. Microsoft SQL Server Management Studio Express  2005 doesn't  have intellisense, so you need to remember this name and type it correctly.  Management Studio 2008 is goingto have intellisense, but still better to have friendly name.

2.The primary benefit of a synonym is realized when you use them as a layer of abstraction between the underlying objects and the synonym. You can have underlying table to be located on different database and reference it as a local table. For example, you can havethree different databases on the same server:






dbCommon would have common tables for all three projects, for example zip codes or states. So, each dbProject would have synonym referencing tables in dbCommon.

Posted on Sunday, June 29, 2008 by | Add Comment

New Comment

Your Name:
Email (for internal use only):
Code above:


Valid HTML5