SQL Server2005 Synonyms

Source: Internet
Author: User

1. Synonyms (synonym) is a new feature in SQL Server 2005

It is an alias that is given to an existing or potential new object. This alias can be used in the same database or across data, which replaces the original object. An object that can be built with aliases:

2. Advantages:

2.1 Flexibility to change the position of the object without changing the existing program code, the UI configuration of the database links without changes.

2.2 Create synonyms in the same database to provide backward compatibility for older applications to avoid deleting

or rename the object.

2.3 Create synonyms across databases to simplify statements that provide cross-database access.

3. Disadvantages

Synonyms (synonyms) are very loosely bound to the referenced object, and no warnings and hints are removed when the referenced synonym is deleted

4. Examples, creating synonyms across databases

Use [Bencalx]

GO

CREATE synonym [dbo]. [Synuspwebsnapshotemployeewebpullfromdallas] for [Bencalxweb]. [dbo]. [Usp_snapshotemployeewebpullfromdallas]

GO

--Create a new synonym Synuspwebsnapshotemployeewebpullfromdallas in the database Bencalx, point to the stored procedure in the database Bencalxweb usp_ Snapshotemployeewebpullfromdallas

EXEC Synuspwebsnapshotemployeewebpullfromdallas can be executed directly in Bencalx @JobID

Calling a stored procedure in a Bencalxweb database

Https://msdn.microsoft.com/en-us/library/ms177544.aspx

Http://www.ccidnet.com/2010/0714/2115519.shtml

.

SQL Server2005 Synonyms

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.