0

I have a script which uses a synonym. I have to alter that code and the problem is I can't understand which object that synonym refers to. Is there a way to find out? I am using the original database instance where that synonym has been created.

PS I am using MS SQL Server.

Thanks for your time.

5

This seems to work for me:

SELECT
    [Schema] = Sch.name
  , Object   = Syn.name
  , Syn.base_object_name
FROM sys.synonyms          AS Syn
    INNER JOIN sys.schemas AS Sch
        ON Sch.schema_id = Syn.schema_id;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.