When should database synonyms be used?

后端 未结 6 1533
借酒劲吻你
借酒劲吻你 2021-02-03 20:59

I\'ve got the syntax down but I\'m wondering if somebody can provide an illustrative use case where database synonyms are very useful.

6条回答
  •  终归单人心
    2021-02-03 22:02

    When you have database object names hard-coded within existing code.

    Using synonyms might spare you the agony of rewriting old code, sometimes from multiple sources, which has its own ideas of the table or database names.

    I have seen, for example, a code which was written for some production server. The coder has conveniently hard-coded the main table's name is test_data, which worked fine on his workstation. Using synonyms rather than rewriting his code got me home early.

提交回复
热议问题