Truncate remote table using link server

  • Hello,

    I have the linked server called "Target"

    I am running a query from "Server B"

    My intention is to truncate the remote table from query analyzer (sp) from server B.

    When i run select /delete statement

    delete from unionware.Archives.dbo.e_code_temp

    It works but when i use

    truncate table Target.Archives.dbo.e_code_temp

    I get following error

    Server: Msg 117, Level 15, State 1, Line 1

    The object name 'Target.Archives.dbo.' contains more than the maximum number of prefixes. The maximum is 2.

    is there any connection issue or do i have to set up some rpc properties or ????

    Thanks,.

    Brijesh

     

     

     

     

  • The answer is all there, in the message.

    snip from BOL...

    Syntax

    TRUNCATE TABLE name

    As you can see the syntax does not support four-part naming.

    This also leads to the conclusion that you must be in the context of the current db to be able to use TRUNCATE.

    So the answer is, you can DELETE over a linked server, but not TRUNCATE.

    =;o)

    /Kenneth

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

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