Drop/Create index on a table in a DB that's on a linked server...

  • Is it possible to drop/create an index on a table that's in a database you are connected to that is a linked server?

    If so, can someone give an example?

    Assume the linked server is already linked with the name SQLnk, the DB name is STUFF, table name is OWNER and the index name should be OWNER_idx.

    Thanks

  • Look up the EXECUTE statement in BOL:

    EXECUTE ('USE STUFF;DROP INDEX OWNER_idx ON dbo.OWNER')

    AT SQLnk

    The linked server has to support RPC calls:

    EXEC master.dbo.sp_serveroption @server=N'SQLnk', @optname=N'rpc', @optvalue=N'true'

    Oh, and, Warren Peace: SKY HIGH RULES!

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • How can I query to see if rpc is on or off?

  • System catalog view:

    SELECT * FROM sys.servers

    It's one of the properties, is_rpc_out_enabled.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

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

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