Synonyms on a table

  • Hi All,

    I have a synonym on a base table. The base table is changed as per some logic. Somehow I am unable to trucate the table using the synonym.

    If synonym is defined on the base table, and if I say

    "trucate table dbo.<synonym>", it gives error as.

    Msg 1088, Level 16, State 7, Line 1

    Cannot find the object "<synonym name>" because it does not exist or you do not have permissions.

    I do have permission on the synonym, as I am the database owner.

    Any updates from you guys is welcome.

  • Generally speaking DDL is not allowed on synonyms.

    /*****************

    If most people are not willing to see the difficulty, this is mainly because, consciously or unconsciously, they assume that it will be they who will settle these questions for the others, and because they are convinced of their own capacity to do this. -Friedrich August von Hayek

    *****************/

  • I have two databases in one instance of SQL Server. In DB1 I have Table_1 and in DB2 I have a synonym that points to Table_1 in DB1. Whenever I want to clear out the contents of DB1.dbo.Table_1 from DB2 I just use:

    DELETE TOP (100) PERCENT

    FROM DB2.dbo.synonym_for_Table_1

    This seems to work fine for me.

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

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