November 15, 2007

SQL Synonyms

Why? – Once the application deployed then it’s very difficult to change table names. For example think old legacy application database with new application code. In such case Synonyms allows to change name (reference)

Example

CREATE SYNONYM ProductCategory
FOR PrCat


To use the synonym in SQL statements:





SELECT * FROM ProductCategory