8/28/2008
LifeCycle Solutions - Home ( the software development blog )
 

<August 2008>
SunMonTueWedThuFriSat
272829303112
3456789
10111213141516
17181920212223
24252627282930
31123456

Subscribe to this feed:

RSS 2.0 | Atom 1.0 |CDF





Add to Technorati Favorites

Wednesday, August 23, 2006

Referencing fully-qualified object names in SQL Server can be tedious, particularly if you're not using an editor with Intellisense (a la ApexSQL Edit).  If the object you're working with is on a linked server, it becomes even more of a burden to get the full name correct, since it can have 4 parts:  server.database.owner.object

Fortunately, SQL Server 2005 comes to the rescue with a new database feature called synonyms.  Synonyms can be used as an alias to a fully-qualified object name, so the table "ProductionServer.ProductionDatabase.dbo.Parts" can be referenced in your queries as simply "Parts" by issuing the following statement:

CREATE SYNONYM Parts for ProductionServer.ProductionDatabase.dbo.Parts

SELECT * FROM Parts

This can also be done visually in SQL Server Management Studio.
Posted by Brian Parks

© 2006 LifeCycle Solutions, LLC | All Rights Reserved