Please see my other Database Development articles.
Simplifying T-SQL syntax.
Length T-SQL is unfortunately the byproduct of many business requirements in supporting an application.
As the parts of each statement grows (database.schema.object), so the overall length of the entire query.
Synonyms provide a painless method to drastically decrease code bloat in queries by allowing for an arbitrary name to be used in place of much longer statements. I will begin by right-clicking the “Synonyms” node in Object Explorer and chose to create a new one.
After entering the word I wish to replace a lengthy statement, in this case “sp” will replace “sales_people,” I now see my new synonym in the tree.
With my synonym newly created I can begin to use it in place of the original statement.
As you can see, the resultset is the same as when I use the original statement.