Shortcoming of Synonyms

  • Why can't we have a feature like this?

    CREATE SYNONYM LiveServer FOR [MyLiveServer]

    SELECT * FROM [LiveServer].[AnyDB].[AnyLogin].[AnyTable]

    --Ramesh


  • You can create a synonym only to stored procedures, extended stored procedures, functions, views, and tables (plus their variants). A linked server is not in this .

    There are many problems with synonyms, both in terms of query optimizations and confusing code. They are resolved at runtime, and many error checking is delayed

    Regards,

    Andras


    Andras Belokosztolszki, MCPD, PhD
    GoldenGate Software

  • Andras, seems like you've a bad experiences with synonyms....

    And also you can't have a synonym on a database...

    The problem only yells at you when you have so many objects that actually resides in some other database, which is the case here...

    One of the workarounds would be, to create a script of the dependent objects and do a find..replace activity

    --Ramesh


  • There are third party tools to do that (i.e. script the whole database to a set of script files, and allow you play with them, then compare these files with the database, and synchronize the differences). Somehow I think this is a nicer way to develop TSQL, you could use source control with these

    About synonyms, if you are using them for the remote objects there is not much difference. If you start aliasing local objects, you may experience very unpleasant performance hits (and errors )

    Andras


    Andras Belokosztolszki, MCPD, PhD
    GoldenGate Software

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply