Help

  • How to unlink a linked server?

    I have two database server and i just want to unlink them from each other.

  • This example removes the remote server servername and all associated remote logins from the local SQL Server.

    sp_dropserver 'servername', 'droplogins'

  • Alternately, You can execute sp_dropserver for all linked servers using the database cursor. The following example shows how to do this.

    DECLARE @sql NVARCHAR(MAX)

    DECLARE db_cursor CURSOR FOR

    select 'sp_dropserver ''' + [name] + '''' from sys.servers

    OPEN db_cursor

    FETCH NEXT FROM db_cursor INTO @sql

    WHILE @@FETCH_STATUS = 0

    BEGIN

    EXEC (@sql)

    FETCH NEXT FROM db_cursor INTO @sql

    END

    CLOSE db_cursor

    DEALLOCATE db_cursor

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

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